On Thu, Aug 5, 2010 at 8:42 AM, wheres pythonmonks
<wherespythonmo...@gmail.com> 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?

It's not quite the same type of sugar as that, but people sometimes
forget that comparisons can be chained:

if x < y <= z:

Same as:

if x < y and y <= z:
# but y is only evaluated once

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to