Dan Lenski wrote: > 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
> 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? Simple, all comparisons have the same priority: http://docs.python.org/ref/comparisons.html Peter -- http://mail.python.org/mailman/listinfo/python-list