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

Brett Cannon bac@OCF.Berkeley.EDU
Sat, 23 Nov 2002 00:48:25 -0800 (PST)

[Brian Quinlan]

> 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()

In all honesty, the top one.  The *dummy variable strikes me as cluttering
the assignment variables.  I would rather have clutter on the RHS of an
assignment then on the LHS.  Personally it takes me a little bit more
effort to realize that *dummy is going to get assigned what ever is left
over and that it will be unneeded.  I would feel the need to delete the
variable so as to not constantly remember what exactly what it is for or
holding (yes, good naming can handle that but I don't want the bother of
having to read a variable name just to realize that I don't want the

The reason this kind of thing is okay for parameter passing is that you
might have the possibility of extra arguments, but you want that
possibility.  This example, though, does not have that benefit since you
know you don't want what ``dummy`` gets.

I guess I just like very precise, clean assignment and I don't see this
ability helping with that keeping that view.