oddness in string.find(sub,somestring)

From: MyHaz (support.services.complaints_at_gmail.com)
Date: 03/30/05


Date: 30 Mar 2005 03:43:49 -0800

OK i find this a quark in string.find that i think needs some
consideration.

Normally if a substring is not in the searched_string then string.find
returns -1 (why not len(searched_string) + 1, i don't know but
nevermind that) but what if a searched_string == '' ? Then
string.find(substring,searched_string) == 0 ?

example:

>>> import string
>>> searched_string="abcdefg"
>>> substring="123"
>>> print string.find(substring,searched_string)
-1
>>> searched_string=""
>>> print string.find(substring,searched_string)
0
>>>

why would this be? And when is someone going to fix it :P

- Haz