[issue26225] New misleading wording in execution model documenation

2016-01-29 Thread Martin Panter
Martin Panter added the comment: Calling exec() with only one argument is equivalent to exec(..., globals(), locals()). It does not create a new scope for names. So an equivalent of your three-level example is more like >>> i = 'global' >>> def f(): ... i = 'nonlocal' ... class_locals

[issue26225] New misleading wording in execution model documenation

2016-01-27 Thread Andrew Barnert
New submission from Andrew Barnert: In #24129, the wording describing class local bindings in 4.2.2 "Resolution of names" was changed for Python 3.4, 3.5, and 3.6. The new version is a lot clearer for classes--but now it's misleading for `exec`/`eval`. --- > Class definition blocks and

[issue26225] New misleading wording in execution model documenation

2016-01-27 Thread Andrew Barnert
Changes by Andrew Barnert : -- type: -> enhancement ___ Python tracker ___ ___

[issue26225] New misleading wording in execution model documenation

2016-01-27 Thread Eryk Sun
Eryk Sun added the comment: The class example defines "i" as a local variable, which means the CPython operation used for unoptimized code (class or module/exec) is LOAD_NAME, which searches locals, globals, and builtins. The result differs from the exec example because a class is executed