[Python-3000] Droping find/rfind?

Tim Peters tim.peters at gmail.com
Wed Aug 23 03:47:18 CEST 2006


[Guido van Rossum]
> At today's sprint, one of the volunteers completed a patch to rip out
> find() and rfind(), replacing all calls with index()/rindex(). But now
> I'm getting cold feet -- is this really a good idea? (It's been listed
> in PEP 3100 for a long time, but I haven't thought about it much,
> really.)
>
> What do people think?

I'd rather toss index/rindex myself, although I understand that
[r]find's -1 return value for "not found" can trip up newbies.  Like I
care ;-)

If you decide to toss [r]find anyway, I'd rather see "not found" be
spelled with an exception more specific than ValueError (who knows
what all "except ValueError:" is going to catch?  /Just/ that the
substring wasn't found?  Ya, that's something to bet your life on
;-)).


More information about the Python-3000 mailing list