Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type
en.karpachov at ospaz.ru
en.karpachov at ospaz.ru
Thu Aug 25 02:45:59 EDT 2005
On Thu, 25 Aug 2005 00:05:18 -0400
Steve Holden wrote:
> What on earth makes you call this a bug? And what are you proposing that
> find() should return if the substring isn't found at all? please don't
> suggest it should raise an exception, as index() exists to provide that
> functionality.
Returning -1 looks like C-ism for me. It could better return None when none
is found.
index = "Hello".find("z")
if index is not None:
# ...
Now it's too late for it, I know.
--
jk
More information about the Python-list
mailing list