On Wed, 31 Oct 2007 13:31:06 +0000, jelle wrote: > 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) > > idiom, which is a bit of a pity I think.
And what should ``'string'.find('str')`` return? How do you distinguish the not found at all case from the found at the very beginning case!? The simple test you want can be written this way: if 'something' in check: do(something_else) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list