summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/sets.py5
-rw-r--r--Misc/NEWS4
2 files changed, 9 insertions, 0 deletions
diff --git a/Lib/sets.py b/Lib/sets.py
index 2605c98..6d2c032 100644
--- a/Lib/sets.py
+++ b/Lib/sets.py
@@ -102,6 +102,11 @@ class BaseSet(object):
"""
return self._data.iterkeys()
+ # Three-way comparison is not supported
+
+ def __cmp__(self, other):
+ raise TypeError, "can't compare sets using cmp()"
+
# Equality comparisons using the underlying dicts
def __eq__(self, other):
diff --git a/Misc/NEWS b/Misc/NEWS
index 5f415d4..29411ec 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -78,6 +78,10 @@ Extension modules
Library
-------
+- The sets module now raises TypeError in __cmp__, to clarify that
+ sets are not intended to be three-way-compared; the comparison
+ operators are overloaded as subset/superset tests.
+
- Bastion.py and rexec.py are disabled. These modules are not safe in
Python 2.2. or 2.3.