This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients
Date 2003-01-13.05:28:01
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=31435

try_rich_to_3way_compare gives up after LT, EQ and GT all 
return false.  The comparison then falls back to the default 
comparison by object id (addresses).  So, e.g., I can build 
an a, b, and c on my box such that:

>>> a, b, c
(Set([0]), Set([1]), Set([1]))
>>> cmp(b, c)   # b equals c
0
>>> cmp(a, b)   # but a "greater than" b while
1
>>> cmp(a, c)   # a "less than" c, despite that b == c
-1
>>>

This is simply because a is at a lower address than c but at 
a higher address than b:

>>> id(a) < id(c)
True
>>> id(a) > id(b)
True
>>>

I don't think <= for subset is too cute -- sets do have a 
natural and useful partial order.  I don't really care happens 
if you pass them to cmp(), though.  An exception would be 
fine -- sets weren't intended to be "generally" comparable.
History
Date User Action Args
2007-08-23 14:09:52adminlinkissue663701 messages
2007-08-23 14:09:52admincreate