list index()
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Thu Aug 30 22:36:01 EDT 2007
In message <87hcmhebwv.fsf at benfinney.id.au>, Ben Finney wrote:
> zzbbaadd at aol.com writes:
>
>> What's with the index() function of lists throwing an exception on not
>> found?
>
> It's letting you know that the item isn't in the list. There's no
> sensible return value from an "index" function in that condition.
How about returning None? That's what's already done by the dict.get method
by default.
More information about the Python-list
mailing list