Daniel Stutzbach <dan...@stutzbachenterprises.com> added the comment:

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?

----------
nosy: +rhettinger, stutzbach
versions: +Python 2.7 -Python 3.0

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue3829>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to