[Python-Dev] Suirprise!
Barry A. Warsaw
barry@digicool.com
Sat, 21 Apr 2001 11:57:57 -0400
>>>>> "TP" == Tim Peters <tim.one@home.com> writes:
TP> It's "correct". I've been using Python longer than Guido
TP> <wink>, and I'm amazed this is the first time I got bit by
TP> this! Here's a hint:
Oh, that is twisted! :)
Let's throw in some parentheses just to confuse people even more:
>>> 'a' in 'a' == 'a'
1
>>> ('a' in 'a') == 'a'
0
>>> 'a' in ('a' == 'a')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: 'in' or 'not in' needs sequence right argument
>>> 'a' in 'a' == 1
0
>>> ('a' in 'a') == 1
1
>>> 'a' in ('a' == 1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: 'in' or 'not in' needs sequence right argument
>>>>> "PP" == Paul Prescod <paulp@ActiveState.com> writes:
PP> It looks like dubious hypergeneralization to me! <0.7 wink>
PP> Seriously, does this "feature" ever make sense to apply to the
PP> in operator?
I don't know; I wonder if "normal" people think of `in' as a chainable
comparison operator or not. You're not suggesting to change this are
you?
gotta-leave-something-`in'-there-for-job-security-ly y'rs,
-Barry