Message72981
There's a strange condition where cmp() of tuples of unorderable values
returns -1 even though using the unorderable values raises an exception.
If I have these two unorderable values, cmp() raises an expected exception:
>>> s0 = frozenset(['testing 0'])
>>> s1 = frozenset(['testing 1'])
>>> cmp(s0, s1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: cannot compare sets using cmp()
Comparing tuples of the values returns -1:
>>> cmp((s0,), (s1,))
-1
Py3k does raise a TypeError, but the message is indecipherable:
>>> cmp((s0,), (s1,))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: 'tuple' != 'tuple'
(The Py3k message for the set comparison is the same as for Python 2.)
I believe that this is an error; the exception from the underlying item
comparison should be propagated. |
|
Date |
User |
Action |
Args |
2008-09-10 20:33:00 | fdrake | set | recipients:
+ fdrake |
2008-09-10 20:33:00 | fdrake | set | messageid: <1221078780.65.0.750398332014.issue3829@psf.upfronthosting.co.za> |
2008-09-10 20:32:35 | fdrake | link | issue3829 messages |
2008-09-10 20:32:34 | fdrake | create | |
|