Skip to content

Instantly share code, notes, and snippets.

@farces
Created March 7, 2013 12:20

Revisions

  1. Adam McKay created this gist Mar 7, 2013.
    20 changes: 20 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    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