Eric V. Smith <e...@trueblade.com> added the comment:

I believe you're seeing this: 
https://docs.python.org/3/reference/executionmodel.html#naming-and-binding

See the paragraph that starts with "Class definition blocks and arguments to 
exec() and eval() are special in the context of name resolution", and the 
example that follows it.

Basically, you're running eval() as if it were at class scope. I think (but am 
not positive) that this statement, from the exec() documentation, also applies 
to eval(): "Remember that at module level, globals and locals are the same 
dictionary. If exec gets two separate objects as globals and locals, the code 
will be executed as if it were embedded in a class definition."

If so, then eval()'s docs should reference this, too.

----------
nosy: +eric.smith

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34483>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to