>>> 0 or None is None
True
>>> None or 0 is None
False
>>> None or 0 is 0
True

Yes, this is explained in the docs:
The expression x or y first evaluates x; if x is true, its value is
returned; otherwise, y is evaluated and the resulting value is
returned.

Another one (also explainable):
>>> 0 or None == None or 0
True
# Above is same as (operator precedence):
>>> 0 or (None == None) or 0
True
# Here is something different:
>>> (0 or None) == (None or 0)
False
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to