question about True values

Chetan pandyacus.xspam at xspam.sbcglobal.net
Sat Oct 28 20:18:43 EDT 2006


> Steven D'Aprano wrote:
> > On Sat, 28 Oct 2006 03:13:42 +0100, Steve Holden wrote:
>  >
> >>> Finally, while True/False is a good mental mapping for numeric comparisons,
> >>> take the following:
> >>>
> >>>  >>> if "Cliff is a pillar of the open source community":
> >>> ....	print "thank you"
> >>> .... else:
> >>> ....	print "bugger off"
> >>>
> >>> bugger off
> >>>
> 
> First off, even though nobody has called me on it, this example really prints
> "thank you", not "bugger off".  I got confused in my cutting and pasting.
> Sorry about that.
> 
> 
> >>> Clearly this is not true.  (Google Cliff/Dyer open source: only 11 hits.),
> >>> but the string is *something* so the if block gets evaluated.
> >>>
> >>   >>> if "The above example was bollocks":
> >>   ...   print "You don't know what you are talking about"
> >>   ... else:
> >>   ...   print "Sorry: of course you are perfectly correct"
> >>   ...
> >> You don't know what you are talking about
> > Cliff is making a point about semantics, and he's absolutely correct about
> > it, although it is irrelevant since we're talking about two-value logic
> > not semantics.
> Cheers,
> Cliff

I am joining after some network downtime here, so I seem to have missed what
the real issue here is. At the risk of being completely irrelevant to the 
discussion here, I think it doesn't seem to be just about something or 
nothing - is None something or nothing? It seems to be neither:

>>> None
>>> None and True
>>> None or True
True
>>> None and False
>>> None or False
False
>>> False or None
>>> False and None
False
>>> True and None
>>> True or None
True
>>> not None
True

Chetan



More information about the Python-list mailing list