On Aug 30, 5:41 pm, [EMAIL PROTECTED] wrote: > On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]> > wrote: > > > [EMAIL PROTECTED] 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. > > for str: > > find( sub[, start[, end]]) > Return the lowest index in the string where substring sub is > found, such that sub is contained in the range [start, end]. Optional > arguments start and end are interpreted as in slice notation. Return > -1 if sub is not found. > > -1 is used in other languages as well.
In 0-based languages it's often -1 whereas in 1-based languages it's often 0. -- http://mail.python.org/mailman/listinfo/python-list