Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

Paul Rubin http
Tue Aug 30 01:54:04 EDT 2005


"Terry Reedy" <tjreedy at udel.edu> writes:
> The fact that the -1 return *has* lead to bugs in actual code is the 
> primary reason Guido has currently decided that find and rfind should go. 
> A careful review of current usages in the standard library revealed at 
> least a couple bugs even there.

Really it's x[-1]'s behavior that should go, not find/rfind.

Will socket.connect_ex also go?  How about dict.get?  Being able to
return some reasonable value for "failure" is a good thing, if failure
is expected.  Exceptions are for unexpected, i.e., exceptional failures.



More information about the Python-list mailing list