Why is None <= 0
Paul McNett
p at ulmcnett.com
Fri Apr 25 14:54:23 EDT 2008
Gregor Horvath wrote:
> >>> None <= 0
> True
More accurately:
>>> None < 0
True
> Why?
> Is there a logical reason?
None is "less than" everything except for itself:
>>> None < 'a'
True
>>> None < False
True
>>> None == None
True
In my humble opinion, I think that comparisons involving None should
return None, but I trust that the designers came up with this for very
good reasons. As far as I know I've never been bitten by it.
Paul
More information about the Python-list
mailing list