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

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Mar 16 02:07:24 CET 2008


Guido van Rossum wrote:
> Thomas Wouters suggests some new syntax:

>>>>a, b, *c = range(5)

+1 on this.

>>>>*a, b, c = a, b, *c

+0 on allowing * in other than the last position.

> ...     for it in iterables:
> ...         yield *it

+0.5 (due to consistency problems pointed out in others'
comments).

A thought - part of me wants to rewrite the above as

   yield **it

i.e. each * wraps an implicit for loop around
the yield.

-- 
Greg


More information about the Python-3000 mailing list