[issue25484] Operator issue with "in" on same level and preceding ==

2015-10-26 Thread Ezio Melotti
Ezio Melotti added the comment: https://docs.python.org/3/reference/expressions.html#comparisons says that "a op1 b op2 c ... y opN z is equivalent to a op1 b and b op2 c and ... y opN z" and this explains the "unexpected" result: >>> 1 in [1] == True False >>> 1 in [1] and [1] == True False

[issue25484] Operator issue with "in" on same level and preceding ==

2015-10-26 Thread Ezio Melotti
Ezio Melotti added the comment: As far as I understand, this is treated as "x < y < z" or "x == y == z": >>> import ast >>> ast.dump(ast.parse("1 < 2 < 3")) 'Module(body=[Expr(value=Compare(left=Num(n=1), ops=[Lt(), Lt()], comparators=[Num(n=2), Num(n=3)]))]) >>> ast.dump(ast.parse("1 == 2 == 3

[issue25484] Operator issue with "in" on same level and preceding ==

2015-10-26 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti versions: +Python 3.5 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue25484] Operator issue with "in" on same level and preceding ==

2015-10-26 Thread Sapphire Becker
New submission from Sapphire Becker: So I found this while using == as xnor, here's a summary of the issue: >>> "h" in ["h"] == True False >>> ("h" in ["h"]) == True True >>> "h" in (["h"] == True) Traceback (most recent call last): File "", line 1, in TypeError: argument of type 'bool' is not