The following is valid Python (3.7.4) code:
def f():
return 1.and(0)
dis.dis(f)
gives
2 0 LOAD_CONST 1 (1.0)
2 JUMP_IF_FALSE_OR_POP 6
4 LOAD_CONST 2 (0)
>> 6 RETURN_VALUE
This also works for or. Not and xor give SyntaxError. Generally, the structure for this expression seems to be Integer.and(something)
, where something can be any type.
My interpretation of this is, that this is interpreted as a float with a logic operation as its decimal places.
[EDIT]
a = 3
a.not(1)
yields a SyntaxError
l = [1, 2, 3]
3.in(l)
yields True - I can see the purpose of this.
[/EDIT]
The question: Why does this construct exist and what is its purpose (if any)?