Another Wart! string.find() [ was: namespace issue? ]

Tim Peters tim.one at home.com
Fri Jun 22 13:48:06 EDT 2001


[Chris Barker]
> Returning -1 was an unfortunate choice for two reasons:
>
> it is not a false value
>
> it is a valid index into a string

Historical note:  at the time these functions were designed, negative
indices were not allowed:  sequence[negative_int] raised an exception.
Allowing the latter was a later addition to the language, and was a mixed
blessing (for this and other reasons; but I think it was a net win).

> This is all kind of useless discussion however as string.find is
> in far too much code as it is.

Yup:  learn to love it, or be killed <wink>.

> Besides, it really isn't all that bad anyway.

Indeed, *most* endless threads are about things that don't matter <wink>.





More information about the Python-list mailing list