[issue16781] execfile/exec execution of class statement does not access locals()

anatoly techtonik report at bugs.python.org
Wed Dec 26 08:08:18 CET 2012


anatoly techtonik added the comment:

The workaround with the best case is a magical knowledge, which many don't possess and don't understand (I still don't get it). It's very tempting to ask why passing explicit namespace is the best solution, but instead I'd like to concentrate on this case where execfile() is not given any arguments. The documentation says:

   If both dictionaries are omitted, the expression is executed in the environment where execfile() is called.

>From this description I understand that the code should be executed just like inline code. Why it can not? What limitation of Python doesn't make this possible? Is there any secret reason under cover?

----------

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


More information about the Python-bugs-list mailing list