[Python-Dev] {}.getitem() (was Re: PEP-0218)
M.-A. Lemburg
mal@lemburg.com
Thu, 30 Nov 2000 11:55:33 +0100
Peter Funk wrote:
>
> M.-A. Lemburg:
> > Shouldn't be hard to do... the C API for this is already in place:
> > PyDict_Next(). I'd prefer a method .getitem(), though, which then
> > returns a tuple (key, value).
>
> IMO '.pickitem()' would be a better name, since many people would
> think, that 'getitem()' would take some kind of index as parameter.
> Nevertheless I think this is a nice idea, though.
Point taken. How about .fetchitem() -- this doesn't imply any
ordering and can't get confused with __getitem__() et al.
BTW, Moshe's .key() and .value() would break the strong binding
between dictionary keys and values -- I don't see much use in them.
Besides, .fetchitem() provides the same implied functionality.
--
Marc-Andre Lemburg
______________________________________________________________________
Company: http://www.egenix.com/
Consulting: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/