"Steve Holden" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Antoon Pardon wrote:
>> So what happens if you have a module that is collecting string-index
>> pair, colleted from various other parts. In one part you
>> want to select the last letter, so you pythonically choose -1 as
>> index. In an other part you get a result of find and are happy
>> with -1 as an indictation for an invalid index. Then these
>> data meet.
>>
> That's when debugging has to start. Mixing data of such types is
> somewhat inadvisable, don't you agree?
>
> I suppose I can't deny that people do things like that, myself included,
> but mixing data sets where -1 is variously an error flag and a valid
> index is only going to lead to trouble when the combined data is used.

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.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to