[Tutor] Deleting an entry from a dictionary

Kent Johnson kent37 at tds.net
Wed Aug 3 15:14:33 CEST 2005

Smith, Jeff wrote:
> Speaking of which, I note that there is a pop for lists but no shift.  
> Is there a Python idiom for this or is it just
>     val = mylist.shift() =>    (val, mylist) = (mylist[0], mylist[1:])
> which seems a little clumsy.

val = mylist.pop(0)


More information about the Tutor mailing list