PEP 227 (was Re: Nested scopes resolution -- you can breathe again!)

Robin Becker robin at jessikat.fsnet.co.uk
Fri Mar 2 06:06:03 EST 2001


In article <mailman.983466367.2968.python-list at python.org>, Jeremy
Hylton <jeremy at alum.mit.edu> writes
>Or: global NAME in FUNCTION
>
>def eggs():
>    z = 2
>    def spam():
>        def inner():
>            global x in spam, z in eggs
>            x += 1
>            z += x
>        x = 23
>        inner()
>
>Jeremy
>
I suppose you could also add an 'as' clause eg

def eggs():
    x = 2
    def spam():
        def inner():
            global x in spam as spam_x, x in eggs as eggs_x
            spam_x += 1
            eggs_x += x
        x = 23
        inner()

-- 
Robin Becker



More information about the Python-list mailing list