[Python-3000] Droping find/rfind?

Steven Bethard steven.bethard at gmail.com
Wed Aug 23 16:31:55 CEST 2006


On 8/23/06, Guido van Rossum <guido at python.org> wrote:
> 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.
>
> But the -1 is very error-prone, as many have experienced. Also, many
> uses of find() should be replaced by 'in' (long ago, 'in' only
> accepted one-character strings on the left and find() was the best
> alternative) or partition().

FWLIW, I only started using Python at the tail end of 2.2, so the 'in'
started working with substrings pretty early for me.  I do a fair bit
of work with text (my research is in natural language processing) and
yet I have exactly zero instances of [r]find() in my code. So I at
least wouldn't miss them if they were gone.

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