Message173947
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? |
|
Date |
User |
Action |
Args |
2012-10-27 17:31:07 | mark.dickinson | set | recipients:
+ mark.dickinson, docs@python |
2012-10-27 17:31:07 | mark.dickinson | set | messageid: <1351359067.41.0.359232821509.issue16339@psf.upfronthosting.co.za> |
2012-10-27 17:31:07 | mark.dickinson | link | issue16339 messages |
2012-10-27 17:31:07 | mark.dickinson | create | |
|