[Python-Dev] {}.getitem() (was Re: PEP-0218)

M.-A. Lemburg mal@lemburg.com
Thu, 30 Nov 2000 15:00:36 +0100


Guido van Rossum wrote:
> 
> > Just curious: how would you get at the deleted value when
> > using .popfirstkey() ?
> >
> > But you have a point: dict.pop() returning the first filled slot
> > in the dictionary as tuple (key,value) would probably be most
> > effective. It's also nice and short.
> 
> Nice!
>
> > BTW, I don't get the inspiration for the "first" part in those
> > names... it makes you think that there's an order to dictionary
> > items when in reality there isn't.
> 
> Actually there is -- the (arbitrary) order revealed by .keys().

Hmm, but this can change if you modify the dictionary inside the
loop or if you modify the dictionary from some other thread.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/