summaryrefslogtreecommitdiffstats
path: root/Lib/xml/etree
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-01-27 18:17:45 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-01-27 18:17:45 (GMT)
commita56c467ac39ab1a6a2e9dc2fa41a9f573f989839 (patch)
treef65fc7d2a4359328f10c1dd9122a692e78e71e8a /Lib/xml/etree
parent191e850053128f726d6562e1d8306dfe5e4aa8aa (diff)
downloadcpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.zip
cpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.tar.gz
cpython-a56c467ac39ab1a6a2e9dc2fa41a9f573f989839.tar.bz2
Issue #1717: Remove cmp. Stage 1: remove all uses of cmp and __cmp__ from
the standard library and tests.
Diffstat (limited to 'Lib/xml/etree')
-rw-r--r--Lib/xml/etree/ElementTree.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index 782af81..cfac4f7 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -498,10 +498,30 @@ class QName:
return self.text
def __hash__(self):
return hash(self.text)
- def __cmp__(self, other):
+ def __le__(self, other):
if isinstance(other, QName):
- return cmp(self.text, other.text)
- return cmp(self.text, other)
+ return self.text <= other.text
+ return self.text <= other
+ def __lt__(self, other):
+ if isinstance(other, QName):
+ return self.text < other.text
+ return self.text < other
+ def __ge__(self, other):
+ if isinstance(other, QName):
+ return self.text >= other.text
+ return self.text >= other
+ def __gt__(self, other):
+ if isinstance(other, QName):
+ return self.text > other.text
+ return self.text > other
+ def __eq__(self, other):
+ if isinstance(other, QName):
+ return self.text == other.text
+ return self.text == other
+ def __ne__(self, other):
+ if isinstance(other, QName):
+ return self.text != other.text
+ return self.text != other
##
# ElementTree wrapper class. This class represents an entire element