[Python-Dev] Dafanging the find() gotcha
Andrew Koenig
ark@research.att.com
Mon, 5 Aug 2002 18:30:56 -0400 (EDT)
Tim> I don't count that as "a practical fear" unless you actually
Tim> search for empty strings, and I don't believe that you do (or at
Tim> least not on purpose -- you can change my mind in a hurry by
Tim> posting your Python code that does do so, though!). If searching
Tim> for empty strings isn't something you do, then all methods of
Tim> asking about substrings yield the same outcome.
Unless you're trying to teach the language to someone else, in which
case you have to explain the behavior regardless of whether you've
written programs that depend on it.
I doubt you've ever written a program that searches for the string
'asoufnyqcynreqywrycq98746qwh', yet I imagine that you would still
object to a search function that throws an exception when presented
with that particular string.
I'm not trying to be flip here -- I'm trying to make the point that in
my opinion, having a uniform rule is preferable to catching particular
cases that are sometimes mistakes.