This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients docs@python, mark.dickinson
Date 2012-10-27.17:31:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1351359067.41.0.359232821509.issue16339@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2012-10-27 17:31:07mark.dickinsonsetrecipients: + mark.dickinson, docs@python
2012-10-27 17:31:07mark.dickinsonsetmessageid: <1351359067.41.0.359232821509.issue16339@psf.upfronthosting.co.za>
2012-10-27 17:31:07mark.dickinsonlinkissue16339 messages
2012-10-27 17:31:07mark.dickinsoncreate