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 terry.reedy
Recipients docs@python, terry.reedy
Date 2010-05-26.17:36:45
SpamBayes Score 0.0009107456
Marked as misclassified No
Message-id <1274895407.96.0.160223468489.issue8824@psf.upfronthosting.co.za>
In-reply-to
Content
This doc improvement suggestion is inspired by #991196 (and subsequent duplicates) and the current discussion on py-dev in the thread
  'variable name resolution in exec is incorrect'
(which is not a correct claim). I believe there is consensus that the doc for exec needs improving.

My suggestion (which others may amend) is that the following paragraph (from the 3.x builtin functions exec entry)

"In all cases, if the optional parts are omitted, the code is executed in the current scope. If only globals is provided, it must be a dictionary, which will be used for both the global and the local variables. If globals  and locals are given, they are used for the global and local variables, respectively. If provided, locals can be any mapping object."

have these two sentences added:

"If only globals is provided or if onedict is provided as both globals and locals, the code is executed in a new top-level scope. If different objects are given as globals and locals, the code is executed as if it were in a class statement in a new top-level scope."
History
Date User Action Args
2010-05-26 17:36:48terry.reedysetrecipients: + terry.reedy, docs@python
2010-05-26 17:36:47terry.reedysetmessageid: <1274895407.96.0.160223468489.issue8824@psf.upfronthosting.co.za>
2010-05-26 17:36:46terry.reedylinkissue8824 messages
2010-05-26 17:36:45terry.reedycreate