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

Bryan Olson fakeaddress at nowhere.org
Thu Aug 25 18:30:23 EDT 2005


Steve Holden asked:
 > Do you just go round looking for trouble?

In the course of programming, yes, absolutly.

 > 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?

What you just said, versus what the doc says.

 > 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.

There are a number of good options. A legal index is not one of
them.


-- 
--Bryan



More information about the Python-list mailing list