list index()

Terry Reedy tjreedy at udel.edu
Fri Aug 31 02:28:36 EDT 2007


"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. 






More information about the Python-list mailing list