[Python-Dev] string.find() again (was Re: timsort for jython)
Mon, 05 Aug 2002 15:27:11 -0400
>> and I expect *everyone* here has been saved more than once by that
>> '' in 'xyz'
>> currently raises an exception.
> I dunno. The exception has annoyed me too.
Annoyed because it pointed out an error in your code, or because True would
have been a useful result? It's annoyed me too, but it was always for the
> I expect that Andrew Koenig would delight in this question. :-)
Believe me, he already did <wink>.
> I personally see no way to defend ('' in 'x') returning false;
The suggestion is not that it return False, but that it raise an exception,
as in "errors should never pass silently".
> it's so clearly a substring that any definition of substring-ness that
> excludes this seems mathematically wrong, despite your good intentions.
I'd like to see a plausible use case for
'' in str
returning True, then. Do keep in mind that nobody can be more anal about
mathematical consistency than me <0.9 wink>, but the real world isn't much
impressed with our abstractions.