[EMAIL PROTECTED] a écrit : > On Aug 30, 4:28 pm, Ben Finney <[EMAIL PROTECTED]> > wrote: >> [EMAIL PROTECTED] writes: >>> On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]> >>> wrote: >>>> 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 -1 if sub is not found. >>> -1 is used in other languages as well. >> It is no more sensible there than in the 'str.find' method, which is a >> historical wart. > > One man's sensible is another man's insensible. For instance, some > people feel -1 as a valid index into a list is sensible. Other's find > it insensible.
Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print "sensible"[-1] e >>> -- http://mail.python.org/mailman/listinfo/python-list