Jan-10-2018, 06:58 PM
&
is bitwise and
it is not quite the same as boolean
and
>>> [(x,y,z) for x in [1, 2, 3] for y in [1, 2, 3] for z in [1, 2, 3] if x != y & x != z & y != z] [(1, 2, 3), (2, 1, 3), (3, 1, 2), (3, 2, 1)] >>> [(x,y,z) for x in [1, 2, 3] for y in [1, 2, 3] for z in [1, 2, 3] if x != y and x != z and y != z] [(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)]