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 stutzbach
Recipients fdrake, gary, rhettinger, stutzbach
Date 2009-03-29.22:23:34
SpamBayes Score 1.9984014e-15
Marked as misclassified No
Message-id <1238365417.02.0.932421656483.issue3829@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2009-03-29 22:23:37stutzbachsetrecipients: + stutzbach, fdrake, rhettinger, gary
2009-03-29 22:23:37stutzbachsetmessageid: <1238365417.02.0.932421656483.issue3829@psf.upfronthosting.co.za>
2009-03-29 22:23:35stutzbachlinkissue3829 messages
2009-03-29 22:23:34stutzbachcreate