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

Paul Rubin http
Thu Aug 25 14:22:16 EDT 2005


Steve Holden <steve at holdenweb.com> writes:
> As far as position reporting goes, it seems pretty clear that find()
> will always report positive index values. In a five-character string
> then -1 and 4 are effectively equivalent.
> 
> What on earth makes you call this a bug? And what are you proposing
> that find() should return if the substring isn't found at all? please
> don't suggest it should raise an exception, as index() exists to
> provide that functionality.

Bryan is making the case that Python's use of negative subscripts to
measure from the end of sequences is bogus, and that it should be done
some other way instead.  I've certainly had bugs in my own programs
related to that "feature".  



More information about the Python-list mailing list