[Python-3000] find -> index patch (original) (raw)
Fredrik Lundh fredrik at pythonware.com
Thu Aug 24 12:35:54 CEST 2006
- Previous message: [Python-3000] find -> index patch
- Next message: [Python-3000] Droping find/rfind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 = -1it 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.
- Previous message: [Python-3000] find -> index patch
- Next message: [Python-3000] Droping find/rfind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]