list index()
Ben Finney
bignose+hates-spam at benfinney.id.au
Wed Sep 5 00:01:51 EDT 2007
Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> writes:
> In message <1188886461.236237.168230 at y42g2000hsy.googlegroups.com>,
> Jason wrote:
>
> > The reason why the exception is more Pythonic is that the return
> > value is always a guaranteed good index into the list.
>
> How do you explain dict.get, then?
I explain it by noting that list.index and dict.get serve totally
different purposes. The former returns the index given a value; the
latter returns a value given a key.
There are many areas of poor symmetry in the language and libraries;
it isn't particularly clever or difficult to find them if one
looks. Doing so doesn't appear to illustrate any point I see relevant
in this thread.
--
\ "If you're a horse, and someone gets on you, and falls off, and |
`\ then gets right back on you, I think you should buck him off |
_o__) right away." -- Jack Handey |
Ben Finney
More information about the Python-list
mailing list