diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-01-31 10:05:05 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-01-31 10:05:05 (GMT) |
commit | 08448a1f4d57e4dd35936b9e43259438d3246c06 (patch) | |
tree | 457d0934f5c53c5acdf93b0a676a0f45cb6ec4fb | |
parent | 57f7db312210fcdc5db00f8e6a67f682ced342e3 (diff) | |
download | cpython-08448a1f4d57e4dd35936b9e43259438d3246c06.zip cpython-08448a1f4d57e4dd35936b9e43259438d3246c06.tar.gz cpython-08448a1f4d57e4dd35936b9e43259438d3246c06.tar.bz2 |
Issue #23326: Removed __ne__ implementations. Since fixing default __ne__
implementation in issue #21408 they are redundant.
-rw-r--r-- | Lib/_pydecimal.py | 9 | ||||
-rw-r--r-- | Lib/argparse.py | 5 | ||||
-rw-r--r-- | Lib/asyncio/events.py | 4 | ||||
-rw-r--r-- | Lib/collections/__init__.py | 5 | ||||
-rw-r--r-- | Lib/datetime.py | 25 | ||||
-rw-r--r-- | Lib/distutils/version.py | 6 | ||||
-rw-r--r-- | Lib/email/charset.py | 3 | ||||
-rw-r--r-- | Lib/email/header.py | 3 | ||||
-rw-r--r-- | Lib/functools.py | 2 | ||||
-rw-r--r-- | Lib/inspect.py | 9 | ||||
-rw-r--r-- | Lib/sched.py | 1 | ||||
-rw-r--r-- | Lib/test/datetimetester.py | 2 | ||||
-rw-r--r-- | Lib/test/test_argparse.py | 3 | ||||
-rw-r--r-- | Lib/test/test_long.py | 2 | ||||
-rw-r--r-- | Lib/unittest/mock.py | 4 | ||||
-rw-r--r-- | Lib/uuid.py | 5 | ||||
-rw-r--r-- | Lib/xml/dom/minidom.py | 3 | ||||
-rw-r--r-- | Lib/xml/etree/ElementTree.py | 4 | ||||
-rw-r--r-- | Lib/xmlrpc/client.py | 9 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
20 files changed, 3 insertions, 104 deletions
diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py index 659e370..ca6c4bd 100644 --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -923,15 +923,6 @@ class Decimal(object): return False return self._cmp(other) == 0 - def __ne__(self, other, context=None): - self, other = _convert_for_comparison(self, other, equality_op=True) - if other is NotImplemented: - return other - if self._check_nans(other, context): - return True - return self._cmp(other) != 0 - - def __lt__(self, other, context=None): self, other = _convert_for_comparison(self, other) if other is NotImplemented: diff --git a/Lib/argparse.py b/Lib/argparse.py index be276bb..ba9e3df 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1209,11 +1209,6 @@ class Namespace(_AttributeHolder): return NotImplemented return vars(self) == vars(other) - def __ne__(self, other): - if not isinstance(other, Namespace): - return NotImplemented - return not (self == other) - def __contains__(self, key): return key in self.__dict__ diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index 8a7bb81..01320cd 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -178,10 +178,6 @@ class TimerHandle(Handle): self._cancelled == other._cancelled) return NotImplemented - def __ne__(self, other): - equal = self.__eq__(other) - return NotImplemented if equal is NotImplemented else not equal - def cancel(self): if not self._cancelled: self._loop._timer_handle_cancelled(self) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 7925af6..ce67f0b 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -987,7 +987,6 @@ class UserList(MutableSequence): def __lt__(self, other): return self.data < self.__cast(other) def __le__(self, other): return self.data <= self.__cast(other) def __eq__(self, other): return self.data == self.__cast(other) - def __ne__(self, other): return self.data != self.__cast(other) def __gt__(self, other): return self.data > self.__cast(other) def __ge__(self, other): return self.data >= self.__cast(other) def __cast(self, other): @@ -1064,10 +1063,6 @@ class UserString(Sequence): if isinstance(string, UserString): return self.data == string.data return self.data == string - def __ne__(self, string): - if isinstance(string, UserString): - return self.data != string.data - return self.data != string def __lt__(self, string): if isinstance(string, UserString): return self.data < string.data diff --git a/Lib/datetime.py b/Lib/datetime.py index 86c80c3..4afe9a5 100644 --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -567,12 +567,6 @@ class timedelta: else: return False - def __ne__(self, other): - if isinstance(other, timedelta): - return self._cmp(other) != 0 - else: - return True - def __le__(self, other): if isinstance(other, timedelta): return self._cmp(other) <= 0 @@ -804,11 +798,6 @@ class date: return self._cmp(other) == 0 return NotImplemented - def __ne__(self, other): - if isinstance(other, date): - return self._cmp(other) != 0 - return NotImplemented - def __le__(self, other): if isinstance(other, date): return self._cmp(other) <= 0 @@ -1079,12 +1068,6 @@ class time: else: return False - def __ne__(self, other): - if isinstance(other, time): - return self._cmp(other, allow_mixed=True) != 0 - else: - return True - def __le__(self, other): if isinstance(other, time): return self._cmp(other) <= 0 @@ -1651,14 +1634,6 @@ class datetime(date): else: return False - def __ne__(self, other): - if isinstance(other, datetime): - return self._cmp(other, allow_mixed=True) != 0 - elif not isinstance(other, date): - return NotImplemented - else: - return True - def __le__(self, other): if isinstance(other, datetime): return self._cmp(other) <= 0 diff --git a/Lib/distutils/version.py b/Lib/distutils/version.py index ebcab84..af14cc1 100644 --- a/Lib/distutils/version.py +++ b/Lib/distutils/version.py @@ -48,12 +48,6 @@ class Version: return c return c == 0 - def __ne__(self, other): - c = self._cmp(other) - if c is NotImplemented: - return c - return c != 0 - def __lt__(self, other): c = self._cmp(other) if c is NotImplemented: diff --git a/Lib/email/charset.py b/Lib/email/charset.py index e999472..ee56404 100644 --- a/Lib/email/charset.py +++ b/Lib/email/charset.py @@ -249,9 +249,6 @@ class Charset: def __eq__(self, other): return str(self) == str(other).lower() - def __ne__(self, other): - return not self.__eq__(other) - def get_body_encoding(self): """Return the content-transfer-encoding used for body encoding. diff --git a/Lib/email/header.py b/Lib/email/header.py index 9c89589..6820ea1 100644 --- a/Lib/email/header.py +++ b/Lib/email/header.py @@ -262,9 +262,6 @@ class Header: # args and do another comparison. return other == str(self) - def __ne__(self, other): - return not self == other - def append(self, s, charset=None, errors='strict'): """Append a string to the MIME header. diff --git a/Lib/functools.py b/Lib/functools.py index fa5bfde..20a26f9 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -223,8 +223,6 @@ def cmp_to_key(mycmp): return mycmp(self.obj, other.obj) <= 0 def __ge__(self, other): return mycmp(self.obj, other.obj) >= 0 - def __ne__(self, other): - return mycmp(self.obj, other.obj) != 0 __hash__ = None return K diff --git a/Lib/inspect.py b/Lib/inspect.py index b789d66..98d665d 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2255,9 +2255,6 @@ class Parameter: self._default == other._default and self._annotation == other._annotation) - def __ne__(self, other): - return not self.__eq__(other) - class BoundArguments: """Result of `Signature.bind` call. Holds the mapping of arguments @@ -2342,9 +2339,6 @@ class BoundArguments: self.signature == other.signature and self.arguments == other.arguments) - def __ne__(self, other): - return not self.__eq__(other) - class Signature: """A Signature object represents the overall signature of a function. @@ -2559,9 +2553,6 @@ class Signature: return (isinstance(other, Signature) and self._hash_basis() == other._hash_basis()) - def __ne__(self, other): - return not self.__eq__(other) - def _bind(self, args, kwargs, *, partial=False): """Private method. Don't use directly.""" diff --git a/Lib/sched.py b/Lib/sched.py index 409d126..b47648d 100644 --- a/Lib/sched.py +++ b/Lib/sched.py @@ -41,7 +41,6 @@ __all__ = ["scheduler"] class Event(namedtuple('Event', 'time, priority, action, argument, kwargs')): def __eq__(s, o): return (s.time, s.priority) == (o.time, o.priority) - def __ne__(s, o): return (s.time, s.priority) != (o.time, o.priority) def __lt__(s, o): return (s.time, s.priority) < (o.time, o.priority) def __le__(s, o): return (s.time, s.priority) <= (o.time, o.priority) def __gt__(s, o): return (s.time, s.priority) > (o.time, o.priority) diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 564ff52..7935cf2 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1305,8 +1305,6 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase): return isinstance(other, LargerThanAnything) def __eq__(self, other): return isinstance(other, LargerThanAnything) - def __ne__(self, other): - return not isinstance(other, LargerThanAnything) def __gt__(self, other): return not isinstance(other, LargerThanAnything) def __ge__(self, other): diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index d7e6cda..a0b9162 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -69,9 +69,6 @@ class NS(object): def __eq__(self, other): return vars(self) == vars(other) - def __ne__(self, other): - return not (self == other) - class ArgumentParserError(Exception): diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index 5f14795..57847d8 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -599,8 +599,6 @@ class LongTest(unittest.TestCase): return (x > y) - (x < y) def __eq__(self, other): return self._cmp__(other) == 0 - def __ne__(self, other): - return self._cmp__(other) != 0 def __ge__(self, other): return self._cmp__(other) >= 0 def __gt__(self, other): diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 9d9b3e2..3b7c157 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -2015,10 +2015,6 @@ class _Call(tuple): return (other_args, other_kwargs) == (self_args, self_kwargs) - def __ne__(self, other): - return not self.__eq__(other) - - def __call__(self, *args, **kwargs): if self.name is None: return _Call(('', args, kwargs), name='()') diff --git a/Lib/uuid.py b/Lib/uuid.py index 7b0b413..e627573 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -185,11 +185,6 @@ class UUID(object): return self.int == other.int return NotImplemented - def __ne__(self, other): - if isinstance(other, UUID): - return self.int != other.int - return NotImplemented - # Q. What's the value of being able to sort UUIDs? # A. Use them as keys in a B-Tree or similar mapping. diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py index c76b14d..a5d813f 100644 --- a/Lib/xml/dom/minidom.py +++ b/Lib/xml/dom/minidom.py @@ -545,9 +545,6 @@ class NamedNodeMap(object): def __lt__(self, other): return self._cmp(other) < 0 - def __ne__(self, other): - return self._cmp(other) != 0 - def __getitem__(self, attname_or_tuple): if isinstance(attname_or_tuple, tuple): return self._attrsNS[attname_or_tuple] diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index ca6c7d6..4c109a2 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -532,10 +532,6 @@ class QName: 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 # -------------------------------------------------------------------- diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py index 9435015..047929a 100644 --- a/Lib/xmlrpc/client.py +++ b/Lib/xmlrpc/client.py @@ -340,10 +340,6 @@ class DateTime: s, o = self.make_comparable(other) return s == o - def __ne__(self, other): - s, o = self.make_comparable(other) - return s != o - def timetuple(self): return time.strptime(self.value, "%Y%m%dT%H:%M:%S") @@ -407,11 +403,6 @@ class Binary: other = other.data return self.data == other - def __ne__(self, other): - if isinstance(other, Binary): - other = other.data - return self.data != other - def decode(self, data): self.data = base64.decodebytes(data) @@ -226,6 +226,9 @@ Core and Builtins Library ------- +- Issue #23326: Removed __ne__ implementations. Since fixing default __ne__ + implementation in issue #21408 they are redundant. + - Issue #14099: Restored support of writing ZIP files to tellable but non-seekable streams. |