"in" operator for strings
Henning VON ROSEN
hvrosen at world-online.no
Thu Feb 1 10:50:17 CET 2001
"Pete Shinners" <shredwheat at mediaone.net> skrev i melding
news:hK8e6.141262$y9.26215366 at typhoon.we.rr.com...
> 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"
> >>> "Waldo" in "Ralph Waldo Emerson"
>>> "Waldo" in "Ralph Waldo Emerson".split()
as long as you are looking for a "word"
amike via Henning
> i find this much more intuitive and graceful than the current
> syntax i am repeatedly using...
> >>> "Ralph Emerson".find("Waldo") != -1
> 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