Alexandre Vassalotti <alexan...@peadrop.com> added the comment:

Here is a patch to backport dict and set comprehensions to the trunk.

The patch preserves the Python 3.x's syntax and semantics of the
feature. Although this makes dict and set comprehensions is inconsistent
with list comprehension, I believe this is reasonable since the backport
aimed to improve the compatibility of Python 2.x with Python 3.x.

The patch also adds support for dict and set comprehensions to the
'compiler' package. However, the support is quirky and use the list
comprehension semantics of Python 2.x. This allowed me to keep the patch
simple and to keep myself sane ;-).

Finally, the patch changes the name of the following syntax nodes:
'gen_expr', 'gen_iter', 'gen_if', and 'testlist_gexp'. I don't know if
we have compatibility requirements for this; so I don't know if this is
an issue.

----------
keywords: +patch
nosy: +alexandre.vassalotti
stage:  -> patch review
title: Backport dict comprehensions -> Backport set and dict comprehensions
Added file: 
http://bugs.python.org/file14661/backport_dict_and_set_comprehension.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2333>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to