On 12/04/2010 11:42 PM, Steven D'Aprano wrote:
On Sun, 05 Dec 2010 04:13:02 +0000, Tim Harig wrote:
str.find is more troublesome, because the sentinel -1 doesn't propagate
and is a common source of errors:
result = string[string.find(delim):]
will return a plausible-looking but incorrect result if delim is missing
from string. But the convenience and familiarity of str.find means it
will probably be around forever.
Fortunately, string objects offer both .find() and .index() so
you can choose whether you want sentinels or exceptions according
to your use-case.
-tkc
--
http://mail.python.org/mailman/listinfo/python-list