[docs] [issue28853] locals() and free variables

Martin Panter report at bugs.python.org
Fri Dec 2 20:21:49 EST 2016


Martin Panter added the comment:

Marco, your patch removes the description for class blocks. Is that your intent, or just an accident? See r53954.

My understanding is “function block” is there to distinguish these three modes:

def foo():
    # Function block
    print(locals())

class Bar:
    # Class block
    print(locals())

# Module level
print(locals())

There are patches proposed at Issue 17546 which also address this reference to “free variables”. Perhaps you could provide feedback on them?

Also see Issue 26683 and Issue 12165, about what free variables, locals, nonlocals, non-globals, etc can mean to different people.

----------
nosy: +martin.panter
stage:  -> patch review
versions:  -Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28853>
_______________________________________


More information about the docs mailing list