shouldn't 'string'.find('ugh') return 0, not -1 ?

Simon Brunning simon at brunningonline.net
Wed Oct 31 10:22:45 EDT 2007


On 10/31/07, jelle <jelleferinga at gmail.com> wrote:
> the subject pretty much says it all.
> if I check a string for for a substring, and this substring isn't found,
> should't the .find method return 0 rather than -1?
> this breaks the
>
> if check.find('something'):
>     do(somethingElse)

print 'ughughugh'.find('ugh')

;-)

-- 
Cheers,
Simon B.
simon at brunningonline.net
http://www.brunningonline.net/simon/blog/
GTalk: simon.brunning | MSN: small_values | Yahoo: smallvalues



More information about the Python-list mailing list