Message84438
I don't think the compare is actually masking an exception.
The set type defines a tp_richcompare routine that gets called when
comparing them as members of a tuple, but the set type also defines a
tp_compare routine that does nothing but raise an exception.
Another side effect is that sets are comparable using < etc., but not
with cmp():
>>> s0 = frozenset(['testing 0'])
>>> s1 = frozenset(['testing 1'])
>>> s0 < s1
False
>>> cmp(s0, s1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: cannot compare sets using cmp()
cmp() is gone in 3.0.1 so I've removed Python 3.0 from the versions.
I'm not sure why tp_compare and tp_richcompare work differently. Maybe
Raymond could shed some light? |
|
Date |
User |
Action |
Args |
2009-03-29 22:23:37 | stutzbach | set | recipients:
+ stutzbach, fdrake, rhettinger, gary |
2009-03-29 22:23:37 | stutzbach | set | messageid: <1238365417.02.0.932421656483.issue3829@psf.upfronthosting.co.za> |
2009-03-29 22:23:35 | stutzbach | link | issue3829 messages |
2009-03-29 22:23:34 | stutzbach | create | |
|