[Python-3000] Droping find/rfind?

Steven Bethard steven.bethard at gmail.com
Wed Aug 23 20:29:26 CEST 2006


On 8/23/06, Barry Warsaw <barry at python.org> wrote:
> I agree with Tim -- if we have to get rid of one of them, let's get
> rid of index/rindex and keep find/rfind.  Catching the exception is
> much less convenient than testing for -1.

Could you post a simple example or two?  I keep imagining things like::

    index = text.index(...)
    if 0 <= index:
        ... do something with index ...
    else:
        ...

which looks about the same as::

    try:
        index = text.index(...)
        ... do something with index ...
    except ValueError:
        ...

Is it just that a lot of the else clauses are empty?

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list