New submission from Mika Eloranta:
The following are expected to raise SyntaxError, but they don't:
>>> 0xfor python is weird in ways
15
>>> [0xaor 1, 0xbor 1, 0xcor 1, 0xdor 1, 0xeor 1, 0xfor 1]
[10, 11, 12, 13, 14, 15]
Verified on v2.7.1 and v3.3.2. Probab
Mika Eloranta added the comment:
Mark, can you explain why the first example is valid syntax, but the second one
is not:
>>> 0xaor 1
10
>>> 0xaand 1
File "", line 1
0xaand 1
^
SyntaxError: invalid syntax
I do understand how "0xaor 1"
Mika Eloranta added the comment:
OK, I see... "0xfand 1" is ambiguous "(0xfa)nd 1" vs. "(0xf)and 1".
So, while a bit weird, the behavior is consistent:
>>> 123not in [], 0xfnot in [], 0xfor 1, 0xafor