George Sakkis wrote:
For the record, here's the arbitrary and undocumented (?) order
among some main builtin types:

None < 0 == 0.0 < {} < [] < "" < ()

If you're curious, you can check the source code. Look for default_3way_compare in object.c. Basically the rundown for dissimilar types is:


* None is smaller than anything
* Numbers (as defined by PyNumber_Check) are smaller than everything else
* All other types are compared by type name (and by the address of the type object if the type names are the same).


Pretty arbitrary, yeah. ;)

Steve
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to