Weird expression result
Dan Lenski
dlenski at gmail.com
Mon Aug 18 12:17:34 EDT 2008
On Mon, 18 Aug 2008 18:04:32 +0200, Peter Otten wrote:
> This works just like a < b < c:
>
>>>> 3 in [3] and [3] == True
> False
>
> Peter
Interesting. I agree with the OP that it is confusing!
Does this expansion really get invoked every time there is an expression
of the form??
expr1 binary_op1 expr2 binary_op2 expr3 ...
Seemingly, the answer is yes:
>>> 3 in [3] in [[3],[4]] in [[[3],[4]],5] == [[[3],[2+2]],5]
True
How does this play with standard precedence rules?
Dan
More information about the Python-list
mailing list