mirror of https://github.com/python/cpython
This localization technique is no longer cost effective. (GH-30818)
This commit is contained in:
parent
443dec6c9a
commit
7ad52d174a
|
@ -86,84 +86,84 @@ def wraps(wrapped,
|
|||
# infinite recursion that could occur when the operator dispatch logic
|
||||
# detects a NotImplemented result and then calls a reflected method.
|
||||
|
||||
def _gt_from_lt(self, other, NotImplemented=NotImplemented):
|
||||
def _gt_from_lt(self, other):
|
||||
'Return a > b. Computed by @total_ordering from (not a < b) and (a != b).'
|
||||
op_result = type(self).__lt__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return not op_result and self != other
|
||||
|
||||
def _le_from_lt(self, other, NotImplemented=NotImplemented):
|
||||
def _le_from_lt(self, other):
|
||||
'Return a <= b. Computed by @total_ordering from (a < b) or (a == b).'
|
||||
op_result = type(self).__lt__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return op_result or self == other
|
||||
|
||||
def _ge_from_lt(self, other, NotImplemented=NotImplemented):
|
||||
def _ge_from_lt(self, other):
|
||||
'Return a >= b. Computed by @total_ordering from (not a < b).'
|
||||
op_result = type(self).__lt__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return not op_result
|
||||
|
||||
def _ge_from_le(self, other, NotImplemented=NotImplemented):
|
||||
def _ge_from_le(self, other):
|
||||
'Return a >= b. Computed by @total_ordering from (not a <= b) or (a == b).'
|
||||
op_result = type(self).__le__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return not op_result or self == other
|
||||
|
||||
def _lt_from_le(self, other, NotImplemented=NotImplemented):
|
||||
def _lt_from_le(self, other):
|
||||
'Return a < b. Computed by @total_ordering from (a <= b) and (a != b).'
|
||||
op_result = type(self).__le__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return op_result and self != other
|
||||
|
||||
def _gt_from_le(self, other, NotImplemented=NotImplemented):
|
||||
def _gt_from_le(self, other):
|
||||
'Return a > b. Computed by @total_ordering from (not a <= b).'
|
||||
op_result = type(self).__le__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return not op_result
|
||||
|
||||
def _lt_from_gt(self, other, NotImplemented=NotImplemented):
|
||||
def _lt_from_gt(self, other):
|
||||
'Return a < b. Computed by @total_ordering from (not a > b) and (a != b).'
|
||||
op_result = type(self).__gt__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return not op_result and self != other
|
||||
|
||||
def _ge_from_gt(self, other, NotImplemented=NotImplemented):
|
||||
def _ge_from_gt(self, other):
|
||||
'Return a >= b. Computed by @total_ordering from (a > b) or (a == b).'
|
||||
op_result = type(self).__gt__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return op_result or self == other
|
||||
|
||||
def _le_from_gt(self, other, NotImplemented=NotImplemented):
|
||||
def _le_from_gt(self, other):
|
||||
'Return a <= b. Computed by @total_ordering from (not a > b).'
|
||||
op_result = type(self).__gt__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return not op_result
|
||||
|
||||
def _le_from_ge(self, other, NotImplemented=NotImplemented):
|
||||
def _le_from_ge(self, other):
|
||||
'Return a <= b. Computed by @total_ordering from (not a >= b) or (a == b).'
|
||||
op_result = type(self).__ge__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return not op_result or self == other
|
||||
|
||||
def _gt_from_ge(self, other, NotImplemented=NotImplemented):
|
||||
def _gt_from_ge(self, other):
|
||||
'Return a > b. Computed by @total_ordering from (a >= b) and (a != b).'
|
||||
op_result = type(self).__ge__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
return op_result
|
||||
return op_result and self != other
|
||||
|
||||
def _lt_from_ge(self, other, NotImplemented=NotImplemented):
|
||||
def _lt_from_ge(self, other):
|
||||
'Return a < b. Computed by @total_ordering from (not a >= b).'
|
||||
op_result = type(self).__ge__(self, other)
|
||||
if op_result is NotImplemented:
|
||||
|
|
Loading…
Reference in New Issue