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 martin.panter
Recipients docs@python, martin.panter, rhettinger
Date 2016-04-01.03:36:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1459481776.11.0.164121959283.issue26683@psf.upfronthosting.co.za>
In-reply-to
Content
Regarding “free variables”, in Issue 17546 I proposed the wording “. . . also includes non-local, non-global names”.

In your code example, I would consider y to be 100 percent local to the g() function. It is a function parameter, and “y += 1” should work. I agree x is not a true local, it is a “non-local non-global”. A national variable maybe :)

For functions, considering that you shouldn’t modify the dictionary (original concern in Issue 17546), I do agree the behaviour is a bit strange and inconsistent. It might have made more sense to either only return true locals, or return a complete namespace of locals, non-locals, globals, and builtins. It seems there is no way to get a similar list of non-local non-globals in a class scope.
History
Date User Action Args
2016-04-01 03:36:16martin.pantersetrecipients: + martin.panter, rhettinger, docs@python
2016-04-01 03:36:16martin.pantersetmessageid: <1459481776.11.0.164121959283.issue26683@psf.upfronthosting.co.za>
2016-04-01 03:36:16martin.panterlinkissue26683 messages
2016-04-01 03:36:15martin.pantercreate