easy question on parsing python: "is not None"

Jean-Michel Pichavant jeanmichel at sequans.com
Thu Aug 5 11:58:54 EDT 2010


wheres pythonmonks wrote:
> How does "x is not None" make any sense?  "not x is None" does make sense.
>
> I can only surmise that in this context (preceding is) "not" is not a
> unary right-associative operator, therefore:
>
> x is not None === IS_NOTEQ(X, None)
>
> Beside "not in" which seems to work similarly, is there other
> syntactical sugar like this that I should be aware of?
>
> W
>   
x is not None === not (x is None).

"is not" is an operator, not the combination of 2.


JM



More information about the Python-list mailing list