summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-04-04 08:48:03 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-04-04 08:48:03 (GMT)
commitc47917071afebc9b715586677c87508b7472af69 (patch)
tree89fc5b24d34ce0f345bb3f68226e7170149e3e72 /Lib/collections.py
parentd3179a0179d1ef0fd4881c50202814e339a33cd2 (diff)
downloadcpython-c47917071afebc9b715586677c87508b7472af69.zip
cpython-c47917071afebc9b715586677c87508b7472af69.tar.gz
cpython-c47917071afebc9b715586677c87508b7472af69.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 786a9f7..0d35bfd 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -461,10 +461,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
@@ -478,12 +478,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 filter(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