Python madness in comparisons with None

In python, everything is greater than None,


>>> 0 > None
True
>>> 0 < None
False

>>> 1 > None
True
>>> 1 < None
False
>>> -1 > None
True
>>> -1 < None
False

>>> 'a' > None
True
>>> 'a' < None
False

>>> 1.0 > None
True
>>> 1.0 < None
False

Comments

Popular posts from this blog

Multiple repeat error when the regex has multiple wildcards in python re module

Avoid using global/class-level mutable datatypes like list/dicts

Weakref proxy is for instance only ...