On 11-7-2015 13:20, Chris Angelico wrote:
On Sat, Jul 11, 2015 at 9:12 PM, Luuk <l...@invalid.lan> wrote:
It can occur in an arithmetic expression, and 'not' has a higher precedence
than '+'
(https://docs.python.org/2/reference/expressions.html#operator-precedence)


I think you're misreading the table; 'not' has *lower* precedence than '+'.

But, it gets confusing......
not 0 + 1
False
not 0
True
True + 1
2


i would expect 'not 0 + 1' to return the same value as 'True + 1'

(not 0 + 1) == (not (0 + 1))

ChrisA


But operator precedence of 'not' is higher than of '+' ????
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to