[Python-3000] find -> index patch

Georg Brandl g.brandl at gmx.net
Thu Aug 24 00:52:16 CEST 2006


Josiah Carlson wrote:
> "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),

Are the bugs there in current code too? You should then report them.

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

Not speaking of the inconsistent use of spaces vs. tabs ;)

Another newly-introduced bug:

-                p = str.rfind('\n', 0, p-1) + 1
+                try:p = str.rindex('\n', 0, p-1) + 1
+		except:p=-1

Georg



More information about the Python-3000 mailing list