Well, at first it sounds crazy, but:
>>> True != 2 in [2,3,5] True >>> (True != 2) in [2,3,5] False >>> True != (2 in [2,3,5]) False
When you realize that this is not a simple priority problem, viewing the AST is the only option left:
>>> ast.dump(ast.parse("True != 2 in [2,3,5]")) "Module(body=[Expr(value= Compare(left=Name(id='True', ctx=Load()), ops=[NotEq(), In()], comparators=[Num(n=2), List(elts=[Num(n=2), Num(n=3), Num(n=5)], ctx=Load())]) )])"
And here's a little hint:
>>> ast.dump(ast.parse("1 < 2 <= 3")) 'Module(body=[Expr(value= Compare(left=Num(n=1), ops=[Lt(), LtE()], comparators=[Num(n=2), Num(n=3)]) )])'
So, it turns out that True != 2 in [2,3,5] interpreted as 1 < 2 <= 3 . And your expression
litheor(l) != l in sieve(100)
means
litheor(l) != l and l in sieve(100)
which is True .