boolean OR gotcha

2009-08-04 Thread 1x7y2z9
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 ==

Re: boolean OR gotcha

2009-08-04 Thread Stephen Hansen
# Here is something different: (0 or None) == (None or 0) False What is the actual problem? You quoted the docs, it seems very clear. (0 or None) would return None. (None or 0) would return 0. None is not equal to 0, of course. --S --

Re: boolean OR gotcha

2009-08-04 Thread Jan Kaliszewski
04-08-2009 o 22:11:18 1x7y2z9 1x7y...@gmail.com wrote: 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 I don't see any problem here. The

Re: boolean OR gotcha

2009-08-04 Thread 1x7y2z9
Did not intend that there was a problem. Just a gotcha or a fun little titbit ... maybe. :) On Aug 4, 1:25 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 04-08-2009 o 22:11:18 1x7y2z9 1x7y...@gmail.com wrote: Another one (also explainable): 0 or None == None or 0 True # Above is same