0 + not 0
Gregory Ewing
greg.ewing at canterbury.ac.nz
Sun Jul 12 02:12:00 EDT 2015
Ian Kelly wrote:
> I must concur. The grammar as written does not actually produce 1 +
> not 0. I think it's still worthwhile opening a bug, because the
> behavior is surprising and possibly not intentional.
It's almost certainly intentional. If you want
not a + b > c
to be interpreted as
not (a + b > c)
rather than
(not a) + b > c
then 'not' has to be higher up in the chain of
grammar productions than the arithmetic operations.
Maintaining that while allowing 'a + not b' would
require contortions in the grammar that wouldn't be
worth the very small benefit that would be obtained.
--
Greg
More information about the Python-list
mailing list