[Tutor] find is confusing..?

Andrei Kulakov ak@silmarill.org
Tue, 25 Jun 2002 22:08:47 -0400


Hello snake eaters..

I just realized that "string".find('str') is very counter-intuitive.. 

if "string".find("str"):
    print "found str!" # won't work

Wouldn't it be much nicer if find returned true if something was found,
and false if it wasn't, and you'd use index() to find the position,
which would return -1 if it wasn't found?

The reason I ask is that I thought.. maybe there's a good reason for
this that I'm missing. Is there?

Thanks,

 - Andrei

-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org