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

Michael Powe michael at trollope.org
Sat Jun 23 14:37:50 EDT 2001


>>>>> "Tim" == Tim Peters <tim.one at home.com> writes:

    Tim> [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

    Tim> Historical note: at the time these functions were designed,
    Tim> negative indices were not allowed: sequence[negative_int]
    Tim> raised an exception.  Allowing the latter was a later
    Tim> addition to the language, and was a mixed blessing (for this
    Tim> 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.

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

Well, IIRC, the introduction of ANSI C broke some old implementations,
so precedent is there.  Any such changes are simply likely to cause
implementations to be brought into compliance on a 'need' basis.

mp

-- 
  Michael Powe                                 Portland, Oregon USA
'Unless we approve your idea, it will not be permitted, it will not be
allowed.'  -- Hilary Rosen, President, Recording Industry Association
of America



More information about the Python-list mailing list