list index()

Thorsten Kampe thorsten at thorstenkampe.de
Mon Sep 3 14:45:58 EDT 2007


* Terry Reedy (Fri, 31 Aug 2007 02:28:36 -0400)
> "Marc 'BlackJack' Rintsch" <bj_666 at gmx.net> wrote in message 
> news:5jn9qgFdmbcU3 at mid.uni-berlin.de...
> | On Thu, 30 Aug 2007 17:09:36 +1000, 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.
> |
> | What about -1?  C programmers do this all the time.  :-)
> 
> Because they do not have exceptions. 

They have plenty of - but they can't catch them :)

Thorsten



More information about the Python-list mailing list