[Python-Dev] 2.5 and beyond

skip at pobox.com skip at pobox.com
Fri Jun 30 13:33:03 CEST 2006


    Ping> The question is, what behaviour is preferable for this code:

    Ping>     g = 1
    Ping>     def f():
    Ping>         g += 1

    Ping>     f()

If you treat "g += 1" as "g = g + 1" then it should create a local variable
with a value of 2.  There being no global statement in f() it must not
modify the global variable.

Skip


More information about the Python-Dev mailing list