> 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?
I belive str.find should return the first position where the substring appears.
If "string".find("ugh") were to return 0, how would you differentiate from
"ugh".find("ugh")? That one *should* return 0.
> this breaks the
>
> if check.find('something'):
> do(somethingElse)
>
> idiom, which is a bit of a pity I think.
It breaks the idiom because you are speaking the wrong language.
You should be doing:
if "something" in "string":
do(something())
wich is clearer IMHO.
> cheers,
>
> -jelle
See ya,
--
Luis Zarrabeitia
Facultad de Matemática y Computación, UH
http://profesores.matcom.uh.cu/~kyrie
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
"Al mundo nuevo corresponde la Universidad nueva"
UNIVERSIDAD DE LA HABANA
280 aniversario
--
http://mail.python.org/mailman/listinfo/python-list