samwyse a écrit :
> George Sakkis wrote:
>> On May 29, 11:33 pm, Matimus <[EMAIL PROTECTED]> 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.

Remember all these are copies of the original sequence, the lisp
equivalent to car/cdr is feasible with an iterator :

it = iter(seq)
car, cdr = it.next(), it

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to