[Python-Dev] Half-baked proposal: * (and **?) in assignments

Brian Quinlan brian@sweetapp.com
Sat, 23 Nov 2002 00:35:05 -0800


Brett Cannon wrote:
> > does (in effect) a=1, b=2, c=(3,4,5), I suggest that
> >
> >     a,b,*c = 1,2,3,4,5
> >
> > should do a=1, b=2, c=(3,4,5) too. Likewise,
> >
> >     a,b,c,d,e = 1,2,*(3,4,5)
> >
> > should be parallel to
> >
> >     def f(a,b,c,d,e): ...
> >     f(1,2,*(3,4,5))
> >
> 
> This just strikes me as YAGNI.  I have never felt the need to have 
> this kind of assignment outside of parameter passing.

Need is a bit too strong. But which do you like better:

year, month, day = time.localtime()[0:3]

or 

year, month, day, *dummy = time.localtime()

Cheers,
Brian