Skip to content

Instantly share code, notes, and snippets.

@farces
Created March 7, 2013 12:20
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 farces/5107667 to your computer and use it in GitHub Desktop.
Save farces/5107667 to your computer and use it in GitHub Desktop.
mydict = {}
mydict['penis'] = "boner"
def thing_one():
for k,v in mydict.items():
print "%s %s" % (k,v)
def thing_two():
for k,v in mydict.items():
print "%s %s" % (k,v)
mydict = {}
>>> thing_one()
penis boner
>>> thing_two()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in thing_two
UnboundLocalError: local variable 'mydict' referenced before assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment