Skip to content

Commit 08448a1

Browse files
Issue #23326: Removed __ne__ implementations. Since fixing default __ne__
implementation in issue #21408 they are redundant.
1 parent 57f7db3 commit 08448a1

File tree

20 files changed

+3
-104
lines changed

20 files changed

+3
-104
lines changed

Lib/_pydecimal.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -923,15 +923,6 @@ def __eq__(self, other, context=None):
923923
return False
924924
return self._cmp(other) == 0
925925

926-
def __ne__(self, other, context=None):
927-
self, other = _convert_for_comparison(self, other, equality_op=True)
928-
if other is NotImplemented:
929-
return other
930-
if self._check_nans(other, context):
931-
return True
932-
return self._cmp(other) != 0
933-
934-
935926
def __lt__(self, other, context=None):
936927
self, other = _convert_for_comparison(self, other)
937928
if other is NotImplemented:

Lib/argparse.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,11 +1209,6 @@ def __eq__(self, other):
12091209
return NotImplemented
12101210
return vars(self) == vars(other)
12111211

1212-
def __ne__(self, other):
1213-
if not isinstance(other, Namespace):
1214-
return NotImplemented
1215-
return not (self == other)
1216-
12171212
def __contains__(self, key):
12181213
return key in self.__dict__
12191214

Lib/asyncio/events.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ def __eq__(self, other):
178178
self._cancelled == other._cancelled)
179179
return NotImplemented
180180

181-
def __ne__(self, other):
182-
equal = self.__eq__(other)
183-
return NotImplemented if equal is NotImplemented else not equal
184-
185181
def cancel(self):
186182
if not self._cancelled:
187183
self._loop._timer_handle_cancelled(self)

Lib/collections/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,6 @@ def __repr__(self): return repr(self.data)
987987
def __lt__(self, other): return self.data < self.__cast(other)
988988
def __le__(self, other): return self.data <= self.__cast(other)
989989
def __eq__(self, other): return self.data == self.__cast(other)
990-
def __ne__(self, other): return self.data != self.__cast(other)
991990
def __gt__(self, other): return self.data > self.__cast(other)
992991
def __ge__(self, other): return self.data >= self.__cast(other)
993992
def __cast(self, other):
@@ -1064,10 +1063,6 @@ def __eq__(self, string):
10641063
if isinstance(string, UserString):
10651064
return self.data == string.data
10661065
return self.data == string
1067-
def __ne__(self, string):
1068-
if isinstance(string, UserString):
1069-
return self.data != string.data
1070-
return self.data != string
10711066
def __lt__(self, string):
10721067
if isinstance(string, UserString):
10731068
return self.data < string.data

Lib/datetime.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -567,12 +567,6 @@ def __eq__(self, other):
567567
else:
568568
return False
569569

570-
def __ne__(self, other):
571-
if isinstance(other, timedelta):
572-
return self._cmp(other) != 0
573-
else:
574-
return True
575-
576570
def __le__(self, other):
577571
if isinstance(other, timedelta):
578572
return self._cmp(other) <= 0
@@ -804,11 +798,6 @@ def __eq__(self, other):
804798
return self._cmp(other) == 0
805799
return NotImplemented
806800

807-
def __ne__(self, other):
808-
if isinstance(other, date):
809-
return self._cmp(other) != 0
810-
return NotImplemented
811-
812801
def __le__(self, other):
813802
if isinstance(other, date):
814803
return self._cmp(other) <= 0
@@ -1079,12 +1068,6 @@ def __eq__(self, other):
10791068
else:
10801069
return False
10811070

1082-
def __ne__(self, other):
1083-
if isinstance(other, time):
1084-
return self._cmp(other, allow_mixed=True) != 0
1085-
else:
1086-
return True
1087-
10881071
def __le__(self, other):
10891072
if isinstance(other, time):
10901073
return self._cmp(other) <= 0
@@ -1651,14 +1634,6 @@ def __eq__(self, other):
16511634
else:
16521635
return False
16531636

1654-
def __ne__(self, other):
1655-
if isinstance(other, datetime):
1656-
return self._cmp(other, allow_mixed=True) != 0
1657-
elif not isinstance(other, date):
1658-
return NotImplemented
1659-
else:
1660-
return True
1661-
16621637
def __le__(self, other):
16631638
if isinstance(other, datetime):
16641639
return self._cmp(other) <= 0

Lib/distutils/version.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ def __eq__(self, other):
4848
return c
4949
return c == 0
5050

51-
def __ne__(self, other):
52-
c = self._cmp(other)
53-
if c is NotImplemented:
54-
return c
55-
return c != 0
56-
5751
def __lt__(self, other):
5852
c = self._cmp(other)
5953
if c is NotImplemented:

Lib/email/charset.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ def __str__(self):
249249
def __eq__(self, other):
250250
return str(self) == str(other).lower()
251251

252-
def __ne__(self, other):
253-
return not self.__eq__(other)
254-
255252
def get_body_encoding(self):
256253
"""Return the content-transfer-encoding used for body encoding.
257254

Lib/email/header.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,6 @@ def __eq__(self, other):
262262
# args and do another comparison.
263263
return other == str(self)
264264

265-
def __ne__(self, other):
266-
return not self == other
267-
268265
def append(self, s, charset=None, errors='strict'):
269266
"""Append a string to the MIME header.
270267

Lib/functools.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,6 @@ def __le__(self, other):
223223
return mycmp(self.obj, other.obj) <= 0
224224
def __ge__(self, other):
225225
return mycmp(self.obj, other.obj) >= 0
226-
def __ne__(self, other):
227-
return mycmp(self.obj, other.obj) != 0
228226
__hash__ = None
229227
return K
230228

Lib/inspect.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,9 +2255,6 @@ def __eq__(self, other):
22552255
self._default == other._default and
22562256
self._annotation == other._annotation)
22572257

2258-
def __ne__(self, other):
2259-
return not self.__eq__(other)
2260-
22612258

22622259
class BoundArguments:
22632260
"""Result of `Signature.bind` call. Holds the mapping of arguments
@@ -2342,9 +2339,6 @@ def __eq__(self, other):
23422339
self.signature == other.signature and
23432340
self.arguments == other.arguments)
23442341

2345-
def __ne__(self, other):
2346-
return not self.__eq__(other)
2347-
23482342

23492343
class Signature:
23502344
"""A Signature object represents the overall signature of a function.
@@ -2559,9 +2553,6 @@ def __eq__(self, other):
25592553
return (isinstance(other, Signature) and
25602554
self._hash_basis() == other._hash_basis())
25612555

2562-
def __ne__(self, other):
2563-
return not self.__eq__(other)
2564-
25652556
def _bind(self, args, kwargs, *, partial=False):
25662557
"""Private method. Don't use directly."""
25672558

0 commit comments

Comments
 (0)