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

Thomas Wouters thomas at python.org
Sun Mar 16 15:35:51 CET 2008


On Sat, Mar 15, 2008 at 11:26 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:

> Thomas Wouters wrote:
> >
> > On Sat, Mar 15, 2008 at 6:07 PM, Greg Ewing <greg.ewing at canterbury.ac.nz
> > <mailto:greg.ewing at canterbury.ac.nz>> wrote:
> >
> >      >>>>*a, b, c = a, b, *c
> >
> >     +0 on allowing * in other than the last position.
> >
> > The left-hand side of all this is already in. Only the rhs is new.
>
> I'm worried that allowing things like
>
>   x = a, b, *c, d, *e, f
>
> is going to make people want to do this in a function
> call as well. Does your patch permit that, or only
> when constructing a tuple?
>

The patch does not, yet. Guido did ask that it would work. (To be precise,
he asked for 'f(*a, b, c)' to be valid, but it only makes sense to allow,
say, 'f(*a, b, *c)' too, and he hasn't said 'no' to that.) However, the
grammar for functiondefinitions and -calls is entirely separate from the
other unpacking contexts, and modifying the grammer is hard; I'm not done
with it yet.

-- 
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20080316/731feb62/attachment-0001.htm 


More information about the Python-3000 mailing list