'in' operator

Tim Peters tim.one at home.com
Sat Feb 17 13:34:59 EST 2001


[Jeff Epler]
> ...
> However, I think that
> 	"" in "yY"
> and
> 	0 in "yY"
> should return 0, because for all items in "yY", none of them are
> "" or 0.  (This is compared to raising an error)

As explained earlier, that's exactly why Python raises TypeError for

    x in y

when type(x) is such that it can't possibly succeed:  you think the first
example should return 0, the original questioner thought 1.  Python refuses
to guess which one of you wrote it <wink>.

say-what-you-mean-and-there's-no-problem-ly y'rs  - tim





More information about the Python-list mailing list