This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients docs@python, martin.panter, rhettinger
Date 2016-04-01.04:53:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1459486424.89.0.597390584648.issue26683@psf.upfronthosting.co.za>
In-reply-to
Content
> A national variable maybe :)

I would think that "nonlocal" is exactly the right term given that that is how you would declare it if you wanted to write to it.

>>> w = 5

>>> def f(x):
        def g(y):
            nonlocal x
            global w
            z = x + y
            x += 1
            print(locals())
            print(globals())
        return g

>>> f(10)(20)
{'y': 20, 'x': 11, 'z': 30}
{'w': 5, ...}
History
Date User Action Args
2016-04-01 04:53:44rhettingersetrecipients: + rhettinger, docs@python, martin.panter
2016-04-01 04:53:44rhettingersetmessageid: <1459486424.89.0.597390584648.issue26683@psf.upfronthosting.co.za>
2016-04-01 04:53:44rhettingerlinkissue26683 messages
2016-04-01 04:53:44rhettingercreate