[Python-3000] find -> index patch
Fredrik Lundh
fredrik at pythonware.com
Thu Aug 24 12:35:54 CEST 2006
Guido van Rossum 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.
since most of the changes appear to be variations of the pattern
- index = foo.find(bar)
+ try:
+ index = foo.index(bar)
+ except:
+ index = -1
it sure looks like the "get rid of find; it's the same thing as index" idea might
be somewhat misguided. I think I'm "idea".find("good") on this one. better
use this energy on partitionifying the 2.6 standard library instead.
</F>
More information about the Python-3000
mailing list