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 ncoghlan
Recipients
Date 2007-02-15.12:13:57
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
For reference, the original set comprehensions patch & the py3k list discussion:
  http://www.python.org/sf/1548388
  http://mail.python.org/pipermail/python-3000/2006-December/005188.html

Note that the current patch ended up looking a *lot* like the original one (the main difference specific to list comprehensions is that the temporary list is built in the inner scope and then returned rather than being passed in as an argument. Additionally, the code has been unified only for the symtable stage - the AST and compilation stages still use separate code for listcomps and genexps).

It turns out that there are some really curly scoping problems that using a nested function deals with automatically (see the new test_listcomps.py in the patch for examples). Having a more efficient mechanism specifically for 'transient' scopes like this is an interesting idea, but it's far from easy (mainly because the variables in the scope still need to be properly visible in scopes it *contains*).

Adding set comprehensions on top of this patch should be pretty straightforward.
History
Date User Action Args
2007-08-23 15:56:35adminlinkissue1660500 messages
2007-08-23 15:56:35admincreate