Question about 'None'

Fredrik Lundh fredrik at
Thu Jan 27 15:44:50 EST 2005

Steven Bethard wrote:

> So None being smaller than anything (except itself) is hard-coded into Python's compare routine. 
> My suspicion is that even if/when objects of different types are no longer comparable by default 
> (as has been suggested for Python 3.0), None will still compare as smaller than anything...

from the change log for Python 2.1:

    "An implementation detail changed in 2.1a1 such that None now compares
    less than any other object.  Code relying on this new behavior (like code
    that relied on the previous behavior) does so at its own risk."

the documentation (which I quoted earlier) still applies.


More information about the Python-list mailing list