Lie wrote:

On Mar 20, 4:18 am, Stef Mientki <stef.mien...@gmail.comwrote:
>hello,

by accident I typed a double value test,

and to my surprise it seems to work.

Is this valid ?

a = 2

b = 2

a == b == 2

thanks,

Stef Mientki

a == b == 2

is equivalent to

a == b and b == 2

except that b is only evaluated once for the whole comparison

Yes - there seems to be unanimity.

Comparisons can be chained arbitrarily,

e.g., x < y <= z is equivalent to x < y

and y <= z, except that y is evaluated

only once (but in both cases z is not

evaluated at all when x < y is found to

be false).

Formally, if a, b, c, ..., y, z are

expressions and opa, opb, ..., opy are

comparison operators, then a opa b opb c

....y opy z is equivalent to a opa b and

b opb c and ... y opy z, except that

each expression is evaluated at most once.

Colin W.