I don't believe it does...some time ago I asked about this when I was creating 
a list and I wanted the opposite of list.append() - if you search "prepend to 
a list" you should find the responses I was sent. 

The only solutions Python offers that I'm aware of are to either use 
list.insert() at the zero index, or use list.reverse() with list.append() to 
flip the list around, add an item, then reverse it back to the original order 
with one new item at the beginning. 

-Jay

On Wednesday 03 August 2005 2:21 pm, Smith, Jeff wrote:
> Ummm...that doesn't do what I asked.
>
> pop is a linguistic idiom for
>
> (val, mylist) = (mylist[-1], mylist[0:-1])
>
> shift is the standard idiom for
>
> (val, mylist) = (mylist[0], mylist[1:])
>
> but Python doesn't appear to offer this.
>
> Jeff
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to