[Python-Dev] string.find() again (was Re: timsort for jython)
Skip Montanaro
skip@pobox.com
Mon, 5 Aug 2002 11:52:56 -0500
aahz> Well, of course it can't be changed, but if Tim of all people made
aahz> that mistake, I think it's a good indicator that something's
aahz> wrong.
I don't think that means any such thing. First, bot or not, Tim is allowed
to make the occasional mistake. Everybody does. Making a mistake doesn't
mean the language is flawed in this case. "Find" seems like the perfect
name ("tell me where this is") and its return value is absolutely correct
for further operation on the found substring (where it was found). I don't
believe strings need to grow an .exists() method which in effect does
def exists(self, sub, start=None, end=None):
return self.find(sub, start, end) >= 0
which would probably be used a lot less than .find() anyway.
Skip