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 Peter Eastman
Recipients Peter Eastman, r.david.murray
Date 2015-08-05.20:48:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438807702.34.0.656039705623.issue24800@psf.upfronthosting.co.za>
In-reply-to
Content
Then fix the documentation.  This behavior directly contradicts the documentation of the exec() function.  The question is not what scope the comprehension runs in, it's what scope the script runs in.  See my third example.  A comprehension in the f() function has no problem seeing local variables defined in that function.  If the script were running into the same scope as that function, then comprehensions inside the script would also see those variables.  They don't, clearly demonstrating that the script does *not* run in the same scope, and contradicting the documentation.
History
Date User Action Args
2015-08-05 20:48:22Peter Eastmansetrecipients: + Peter Eastman, r.david.murray
2015-08-05 20:48:22Peter Eastmansetmessageid: <1438807702.34.0.656039705623.issue24800@psf.upfronthosting.co.za>
2015-08-05 20:48:22Peter Eastmanlinkissue24800 messages
2015-08-05 20:48:22Peter Eastmancreate