Just remember that Python is sexy

Duncan Booth duncan.booth at invalid.invalid
Thu May 26 12:10:10 EDT 2005


Sion Arrowsmith wrote:

>>The name index implies it returns something you can use as an index to
>>get at the substring.
> 
> Unfortunately, -1 can of course be used as an index. Mind you, it
> would be perverse to expect to find the substring at it.
> 
That was my point. The returned index always points at the substring, 
therefore the function which returns a -1 isn't returning an index. 
Therefore index must be the one which raises an exception.



More information about the Python-list mailing list