[Python-3000] find -> index patch

Josiah Carlson jcarlson at uci.edu
Wed Aug 23 23:48:40 CEST 2006


"Guido van Rossum" <guido at python.org> wrote:
> Here's the patch (by Hasan Diwan, BTW) for people's perusal. It just
> gets rid of all *uses* of find/rfind from Lib; it doesn't actually
> modify stringobject.c or unicodeobject.c. It doesn't use
> [r]partition()'; someone could look for opportunities to use that
> separately.
> 
> -- 
> --Guido van Rossum (home page: http://www.python.org/~guido/)

There's a bug in the Lib/idlelib/configHandler.py patch, likely 6
unintend bugs exposed in Lib/idlelib/PyParse.py (which are made worse by
the patch), Lib/idlelib/CallTips.py is broken, 4 examples in
Lib/ihooks.py don't require the try/except clause (it is prefixed with a
containment test), Lib/cookielib.py has two new bugs, ...

I stopped at Lib/string.py

Also, there are inconsistant uses of bare except and except ValueError
clauses.

The patch shouldn't be applied for many reasons, not the least of which
is because it breaks currently working code, it offers poorly-styled
code of the form:
    try:... = str.index(...)
    except:...=-1

...that looks to have been done by a script, it has inconsistant style
compared to the code it replaces, etc.

 - Josiah



More information about the Python-3000 mailing list