OK, mystery solved. In Python:
1 in [1,2,3] is True
is evaluated as (1 in [1, 2, 3]) and ([1, 2, 3] is True)
similarly to 1 < 2 < 3
:facepalm: