Message13930
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. |
|
Date |
User |
Action |
Args |
2007-08-23 14:09:52 | admin | link | issue663701 messages |
2007-08-23 14:09:52 | admin | create | |
|