mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #1717: Remove cmp. Stage 1: remove all uses of cmp and __cmp__ from
the standard library and tests.
This commit is contained in:
parent
191e850053
commit
a56c467ac3
32 changed files with 210 additions and 216 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue