[issue2292] Missing *-unpacking generalizations
Thomas Wouters
report at bugs.python.org
Sat Mar 15 16:41:20 CET 2008
New submission from Thomas Wouters <thomas at python.org>:
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]
----------
assignee: gvanrossum
components: Interpreter Core
files: morestar.diff
keywords: patch, patch
messages: 63548
nosy: gvanrossum, twouters
severity: normal
status: open
title: Missing *-unpacking generalizations
versions: Python 3.0
Added file: http://bugs.python.org/file9673/morestar.diff
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2292>
__________________________________
More information about the Python-bugs-list
mailing list