[Python-checkins] python/dist/src/Lib sets.py,1.36,1.37

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 14 Jan 2003 08:40:59 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv1406

Modified Files:
	sets.py 
Log Message:
Explicitly raise an exception in __cmp__ -- this clarifies that cmp()
is not supported on sets.  (Unfortunately, sorting a list of sets may
still return random results because it uses < exclusively, but for
sets that inly implements a partial ordering.  Oh well.)


Index: sets.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** sets.py	25 Nov 2002 20:43:54 -0000	1.36
--- sets.py	14 Jan 2003 16:40:06 -0000	1.37
***************
*** 103,106 ****
--- 103,111 ----
          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