Skip to content

Instantly share code, notes, and snippets.

@ErinCall
Created September 21, 2011 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ErinCall/1230967 to your computer and use it in GitHub Desktop.
Save ErinCall/1230967 to your computer and use it in GitHub Desktop.
ok so this probably isn't what I should be doing, but it definitely isn't what python should be doing
>>> def foo(bar=None):
... def baz():
... if not bar: bar = 'goo'
... print bar
... baz()
...
>>> foo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 5, in foo
File "<stdin>", line 3, in baz
UnboundLocalError: local variable 'bar' referenced before assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment