Question about 'None'
Steven Bethard
steven.bethard at gmail.com
Thu Jan 27 16:15:30 EST 2005
Francis Girard wrote:
> I see. There is some rule stating that all the strings are greater than ints
> and smaller than lists, etc.
Yes, that rule being to compare objects of different types by their type
names (falling back to the address of the type object if the type names
are the same, I believe). Of course, this is arbitrary, and Python does
not guarantee you this ordering -- it would not raise backwards
compatibility concerns to, say, change the ordering in Python 2.5.
> What was the goal behind this rule ?
I believe at the time, people thought that comparison should be defined
for all Python objects. Guido has since said that he wishes the
decision hadn't been made this way, and has suggested that in Python
3.0, objects of unequal types will not have a default comparison.
Probably this means ripping the end off of default_3way_compare and
raising an exception. As Fredrik Lundh pointed out, they could, if they
wanted to, also rip out the code that special-cases None too.
Steve
More information about the Python-list
mailing list