title: Block Scoping in python - is it similar to javascript hoisting when inside a function?
body: <p>I am currently trying to understand this piece of code in python</p>
  
  <pre><code>def foo(a):
    if a==12:
      var = "Same"
    else:
      var = "different"
  </code></pre>
  
  <p>I read and understand the fact that python does not support block based scoping. So everything created inside a function (whether inside a loop or conditional statements) is openly available to other members of a function.I also read the scoping rules <a href="https://stackoverflow.com/questions/291978/short-description-of-python-scoping-rules">here</a> . At this point would it be same to assume that these inner scoped variables are hoisted inside a functions just like they are hoisted in javascript ?</p>