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.
Created on 2008年03月17日 17:37 by brett.cannon, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| backport_dict_and_set_comprehension.diff | alexandre.vassalotti, 2009年08月05日 23:10 | |||
| patch_failure.log | mark.dickinson, 2009年08月06日 16:24 | Output of attempt to apply patch. | ||
| set_and_dict_comprehensions.diff | fossilet, 2012年11月14日 06:56 | review | ||
| Messages (11) | |||
|---|---|---|---|
| msg63690 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2008年03月17日 17:37 | |
Dict comprehensions need to be backported. |
|||
| msg91338 - (view) | Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) | Date: 2009年08月05日 23:09 | |
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. |
|||
| msg91367 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2009年08月06日 16:24 | |
Alexandre, I can't get this to apply cleanly to my svn trunk checkout (r74328) (see attached log). Am I doing something stupid? |
|||
| msg91368 - (view) | Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) | Date: 2009年08月06日 16:44 | |
You need to apply the set literal patch I posted in issue2335 first. |
|||
| msg91369 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2009年08月06日 16:52 | |
Ah, that works. Thanks! (I'll pay more attention to the tracker Dependencies field in future.) |
|||
| msg96257 - (view) | Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) | Date: 2009年12月11日 14:15 | |
If there are no objections, I will commit this patch later this week after issue #2335. |
|||
| msg97611 - (view) | Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) | Date: 2010年01月11日 22:36 | |
Committed in r77422. |
|||
| msg112812 - (view) | Author: METAL XXX (metal) | Date: 2010年08月04日 14:32 | |
How about fixing set.__repr__ ? |
|||
| msg175539 - (view) | Author: Yongzhi Pan (fossilet) * | Date: 2012年11月14日 06:56 | |
Great they are backported to 2.7. Dictionary and set comprehensions are not documented in the tutorial of 2.7, though they are in the language reference. Is it OK to add these to the tutorial? I've uploaded a patch. |
|||
| msg175541 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2012年11月14日 07:07 | |
> Is it OK to add these to the tutorial? I've uploaded a patch. Yes, but please create a new issue. > How about fixing set.__repr__ ? Is it broken? |
|||
| msg175554 - (view) | Author: Yongzhi Pan (fossilet) * | Date: 2012年11月14日 09:00 | |
I think metal means that the different ways set is repr'd in 2.7 and 3.
In 2.7:
In [9]: a = {x for x in 'abracadabra' if x not in 'abc'}
In [10]: repr(a)
Out[10]: "set(['r', 'd'])"
In 3.2:
In [6]: a = {x for x in 'abracadabra' if x not in 'abc'}
In [7]: repr(a)
Out[7]: "{'r', 'd'}"
We were saying not changing __repr__ in #2335.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:31 | admin | set | github: 46586 |
| 2012年11月14日 09:00:10 | fossilet | set | messages: + msg175554 |
| 2012年11月14日 07:07:52 | ezio.melotti | set | messages: + msg175541 |
| 2012年11月14日 06:56:46 | fossilet | set | files:
+ set_and_dict_comprehensions.diff nosy: + fossilet messages: + msg175539 |
| 2010年08月04日 14:39:04 | ezio.melotti | set | nosy:
+ ezio.melotti |
| 2010年08月04日 14:32:53 | metal | set | nosy:
+ metal messages: + msg112812 |
| 2010年01月11日 22:36:41 | alexandre.vassalotti | set | status: open -> closed resolution: accepted messages: + msg97611 stage: patch review -> resolved |
| 2009年12月11日 14:15:09 | alexandre.vassalotti | set | messages: + msg96257 |
| 2009年08月06日 16:52:11 | mark.dickinson | set | messages: + msg91369 |
| 2009年08月06日 16:44:07 | alexandre.vassalotti | set | messages: + msg91368 |
| 2009年08月06日 16:24:07 | mark.dickinson | set | files:
+ patch_failure.log nosy: + mark.dickinson messages: + msg91367 |
| 2009年08月05日 23:12:32 | alexandre.vassalotti | set | dependencies: + Backport set literals |
| 2009年08月05日 23:11:45 | alexandre.vassalotti | link | issue2334 superseder |
| 2009年08月05日 23:10:11 | alexandre.vassalotti | set | files:
+ backport_dict_and_set_comprehension.diff title: Backport dict comprehensions -> Backport set and dict comprehensions keywords: + patch nosy: + alexandre.vassalotti messages: + msg91338 stage: patch review |
| 2008年08月21日 14:51:46 | benjamin.peterson | set | versions: + Python 2.7, - Python 2.6 |
| 2008年03月17日 20:10:00 | brett.cannon | set | priority: release blocker -> critical |
| 2008年03月17日 17:37:33 | brett.cannon | create | |