[Python-3000] Using *a for packing in lists and other places

BJörn Lindqvist bjourne at gmail.com
Sat Mar 15 22:05:08 CET 2008


On Sat, Mar 15, 2008 at 4:15 PM, Guido van Rossum <guido at python.org> wrote:
>  >>> 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]

Can you mix freely?

>>> [*(*item, *item) for item in L]
[0, 1, 2, 0, 1, 2, 3, 4, 3, 4, 5, 5, 6, 6, 7, 8, 9, 7, 8, 9]

-- 
mvh Björn


More information about the Python-3000 mailing list