title: weird issue in python: UnboundLocalError: local variable 'y' referenced before assignment
body: <p>If just got confronted with a weird issue in a program of mine. If simplified my code to the following:</p>
  
  <pre><code>def x(y="test"):
      def xx():
          if False:
              y = "blubb"
          print y
      xx()
      print y
  
  x()
  </code></pre>
  
  <p>This throws the UnboundLocalError: referenced before assignment Error.</p>
  
  <p>If i fix the code to the following:</p>
  
  <pre><code>def x(y="test"):
      def xx():
          print y
      xx()
      print y
  
  x()
  </code></pre>
  
  <p>My code works again. I'm on Python 2.7.
  I've just figured out, that the follow fix work as well and this is how i'm going to fix my software for the moment:</p>
  
  <pre><code>def x(y="test"):
      def xx():
          _y = y
          if False:
              _y = "blubb"
          print _y
      xx()
      print y
  
  x()
  </code></pre>