New submission from Mark Dickinson:
In Python 2, the 'exec' statement supports 'exec'-ing a (statement, globals,
locals) tuple:
>>> exec("print 2", {}, {})
2
This doesn't seem to be documented at
http://docs.python.org/reference/simple_stmts.html#the-exec-statement.
If I understand correctly, the 'exec tuple' form was originally there for
backwards compatibility with ancient versions of Python; however, it now also
conveniently provides the semblance of forwards compatibility with Python 3.
It appears to be supported by current versions of Jython (though judging by
issue 403345 that wasn't always the case) and PyPy.
Is this omission intentional? Is this form of exec an official, supported part
of the Python 2 language?
----------
assignee: docs@python
components: Documentation
messages: 173947
nosy: docs@python, mark.dickinson
priority: normal
severity: normal
stage: needs patch
status: open
title: Document "exec(stmt, global_dict, local_dict)" form in Python 2?
versions: Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16339>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com