scopes? (is: I don't get it ...)

djw donald.welch.nospam at hp.com
Thu May 29 13:21:00 EDT 2003


In order to assign to a global in a funtion, you must use the global
statement, otherwise Python will assume you are assigning to a local.
That's the way I understand it, anyway.

test.py:
t1 = []
t2 = 0
def testme():
        global t2
        print t1
        print t2
        t2+=1


/d/





More information about the Python-list mailing list