"in" operator for strings

Pete Shinners shredwheat at mediaone.net
Thu Feb 1 03:02:21 EST 2001


with the back and forth going on about the "in" operator and
dictionaries, i was thinking it would be nice for the "in"
operator to also check for the presence of substrings in a
string. for example...


>>> "Waldo" in "Ralph Emerson"
0
>>> "Waldo" in "Ralph Waldo Emerson"
1


i find this much more intuitive and graceful than the current
syntax i am repeatedly using...

>>> "Ralph Emerson".find("Waldo") != -1
0


anyways, it may not stand a snowball's chance. but i'd hope
the 'powers that be' could at least take a second to think
about it and explain a yea or nea.

it's just an idea that came to me. i know i would like it, but
there is likely something i'm overlooking. i would think it
could have a serious chance of being accepted?






More information about the Python-list mailing list