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 | twouters |
|---|---|
| Recipients | gvanrossum, twouters |
| Date | 2008年03月15日.15:41:15 |
| SpamBayes Score | 0.11111853 |
| Marked as misclassified | No |
| Message-id | <1205595680.3.0.859525264867.issue2292@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
The attached patch adds the missing *-unpacking generalizations.
Specifically:
>>> a, b, *c = range(5)
>>> *a, b, c = a, b, *c
>>> a, b, c
([0, 1, 2], 3, 4)
>>> [ *a, b, c ]
[0, 1, 2, 3, 4]
>>> L = [ a, (3, 4), {5}, {6: None}, (i for i in range(7, 10)) ]
>>> [ *item for item in L ]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Also, yielding everything from an iterator:
>>> def flatten(iterables):
... for it in iterables:
... yield *it
...
>>> L = [ a, (3, 4), {5}, {6: None}, (i for i in range(7, 10)) ]
>>> flatten(L)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年03月15日 15:41:20 | twouters | set | spambayes_score: 0.111119 -> 0.11111853 recipients: + twouters, gvanrossum |
| 2008年03月15日 15:41:20 | twouters | set | spambayes_score: 0.111119 -> 0.111119 messageid: <1205595680.3.0.859525264867.issue2292@psf.upfronthosting.co.za> |
| 2008年03月15日 15:41:19 | twouters | link | issue2292 messages |
| 2008年03月15日 15:41:18 | twouters | create | |