mirror of https://github.com/python/cpython
Replace the localized min/max calls with normal if/else
This commit is contained in:
parent
013d6cc0df
commit
e3bc5577e8
|
@ -465,10 +465,10 @@ class Counter(dict):
|
||||||
'''
|
'''
|
||||||
if not isinstance(other, Counter):
|
if not isinstance(other, Counter):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
_max = max
|
|
||||||
result = Counter()
|
result = Counter()
|
||||||
for elem in set(self) | set(other):
|
for elem in set(self) | set(other):
|
||||||
newcount = _max(self[elem], other[elem])
|
p, q = self[elem], other[elem]
|
||||||
|
newcount = q if p < q else p
|
||||||
if newcount > 0:
|
if newcount > 0:
|
||||||
result[elem] = newcount
|
result[elem] = newcount
|
||||||
return result
|
return result
|
||||||
|
@ -482,12 +482,12 @@ class Counter(dict):
|
||||||
'''
|
'''
|
||||||
if not isinstance(other, Counter):
|
if not isinstance(other, Counter):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
_min = min
|
|
||||||
result = Counter()
|
result = Counter()
|
||||||
if len(self) < len(other):
|
if len(self) < len(other):
|
||||||
self, other = other, self
|
self, other = other, self
|
||||||
for elem in _ifilter(self.__contains__, other):
|
for elem in _ifilter(self.__contains__, other):
|
||||||
newcount = _min(self[elem], other[elem])
|
p, q = self[elem], other[elem]
|
||||||
|
newcount = p if p < q else q
|
||||||
if newcount > 0:
|
if newcount > 0:
|
||||||
result[elem] = newcount
|
result[elem] = newcount
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue