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

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Fri Aug 26 14:57:11 EDT 2005


Bryan Olson wrote:
> Steve Holden wrote:
>  > Bryan Olson wrote:
>  >> Antoon Pardon wrote:
> 
>  >>  > It probably is too late now, but I always felt, find should
>  >>  > have returned None when the substring isn't found.
>  >>
>  >> None is certainly a reasonable candidate.
> [...]
>  >> The really broken part is that unsuccessful searches return a
>  >> legal index.
>  >>
>  > We might agree, before further discussion, that this isn't the most
>  > elegant part of Python's design, and it's down to history that this tiny
>  > little wart remains.
> 
> I don't think my proposal breaks historic Python code, and I
> don't think it has the same kind of unfortunate subtle
> consequences as the current indexing scheme. You may think the
> wart is tiny, but the duct-tape* is available so let's cure it.
> 
> [*] http://www.google.com/search?as_q=warts+%22duct+tape%22

Well, nobody stops you from posting this on python-dev and be screamed
at by Guido...

just-kidding-ly
Reinhold



More information about the Python-list mailing list