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

Skip Montanaro skip@pobox.com
Sat, 23 Nov 2002 11:12:45 -0600

    >> But which do you like better:
    >> year, month, day = time.localtime()[0:3]
    >> or
    >> year, month, day, *dummy = time.localtime()

    Brett> In all honesty, the top one.  The *dummy variable strikes me as
    Brett> cluttering the assignment variables.  

>From what little ELisp programming I did in the dim dark past, I would
prefer the second variant written as

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

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

Yes you do.  You know it gets the stuff you don't care about. ;-)