Equality operator

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Mar 5 17:18:50 EST 2005


In <1110055534.040063.304150 at f14g2000cwb.googlegroups.com>, italy wrote:

> Why doesn't this statement execute in Python:
> 
> 1 == not 0
> 
> I get a syntax error, but I don't know why. 

`==` has a higher precedence than `not` so Python interprets it as::

  (1 == not) 0

This works::

  >>> 1 == (not 0)
  True

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list