Op 2005-08-25, Bryan Olson schreef <[EMAIL PROTECTED]>: > 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.
IMO, with find a number of "features" of python come together. that create an awkward situation. 1) 0 is a false value, but indexes start at 0 so you can't return 0 to indicate nothing was found. 2) -1 is returned, which is both a true value and a legal index. It probably is too late now, but I always felt, find should have returned None when the substring isn't found. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list