Arithmetic with Boolean values

Chris Angelico rosuav at gmail.com
Sat Aug 11 20:31:22 EDT 2012


On Sun, Aug 12, 2012 at 10:25 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 8/11/2012 7:13 PM, Chris Angelico wrote:
>> This appears to be a limitation of the parser; it's trying to
>> interpret "not" as a binary operator.
>
> I think not. It is lower precedence than all arithmetic operators.
> (We humans see that that is impossible and
> may boost the precedence in context.)

Ah, I stand corrected. And once again, I kinda expected Python to
follow the rules of my mental parser :)

Anyway, point stands that parens will fix the issue.

ChrisA



More information about the Python-list mailing list