summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-04-04 08:46:58 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-04-04 08:46:58 (GMT)
commite3bc5577e86e99f07503cb05ca2822f870b2d110 (patch)
tree42783fc2381d7bf9bd88ab41e13081c9c9f5cbb6 /Lib/collections.py
parent013d6cc0df238013075930c5adb1c4724f38aa49 (diff)
downloadcpython-e3bc5577e86e99f07503cb05ca2822f870b2d110.zip
cpython-e3bc5577e86e99f07503cb05ca2822f870b2d110.tar.gz
cpython-e3bc5577e86e99f07503cb05ca2822f870b2d110.tar.bz2
Replace the localized min/max calls with normal if/else
Diffstat (limited to 'Lib/collections.py')
-rw-r--r--Lib/collections.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index fb53900..1e83a90 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -465,10 +465,10 @@ class Counter(dict):
'''
if not isinstance(other, Counter):
return NotImplemented
- _max = max
result = Counter()
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:
result[elem] = newcount
return result
@@ -482,12 +482,12 @@ class Counter(dict):
'''
if not isinstance(other, Counter):
return NotImplemented
- _min = min
result = Counter()
if len(self) < len(other):
self, other = other, self
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:
result[elem] = newcount
return result