Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type
Tue Aug 30 10:34:32 CEST 2005
"Terry Reedy" <tjreedy at udel.edu> writes:
> > Really it's x[-1]'s behavior that should go, not find/rfind.
> I complete disagree, x[-1] as an abbreviation of x[len(x)-1] is extremely
> useful, especially when 'x' is an expression instead of a name.
There are other abbreviations possible, for example the one in the
proposed PEP at the beginning of this thread.
> But even
> if -1 were not a legal subscript, I would still consider it a design error
> for Python to mistype a non-numeric singleton indicator as an int.
OK, .find should return None if the string is not found.
More information about the Python-list