Rats! vararg assignments don't work

samwyse dejanews at email.com
Wed May 30 06:42:08 EDT 2007


George Sakkis wrote:
> On May 29, 11:33 pm, Matimus <mccre... at gmail.com> wrote:
> 
> 
>>Your attemtp:
>>
>>[code]
>>first, rest = arglist[0], arglist[1:]
>>[/code]
>>
>>Is the most obvious and probably the most accepted way to do what you
>>are looking for. As for adding the fucntionality you first suggested,
>>it isn't likely to be implemented. The first step would be to write a
>>PEP though.
> 
> 
> The time machine did it again: http://www.python.org/dev/peps/pep-3132/.

Thanks!  Now I just need to wait for Py3K and all of my problems will be 
solved.  ;-)

Actually, I'm surprised that the PEP does as much as it does.  If tuples 
are implemented as S-expressions, then something like this:
     car, *cdr = tuple
while leaving cdr a tuple would be trivial to implement.  Of course, I'm 
an old-school LISPer, so what I consider surprising behavior doesn't 
always surprise anyone else, and vice versa.



More information about the Python-list mailing list