[Python-ideas] Deprecate str.find

Terry Reedy tjreedy at udel.edu
Sat Jul 16 21:52:39 CEST 2011


On 7/16/2011 2:46 PM, Terry Reedy wrote:
> On 7/15/2011 6:50 PM, Cameron Simpson wrote:
>> On 15Jul2011 12:12, Mike
>> Graham<mikegraham at gmail.com> wrote:
>> age etc.
>>
>> str.find does not have a failure mode, it has string found and string
>> not found.
>
> Not finding == failure to find == failure to match an implied re.

Indeed, negative values such as -1 are standard error/failure return 
codes for functions that normally return nonnegative ints and that 
written in statically typed languages without catchable exceptions. In 
C, for instance, EOF is defined as an implementation-defined negative 
int and I am sure -1 is used by some.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list