]> granicus.if.org Git - python/commitdiff
Replace the localized min/max calls with normal if/else
authorRaymond Hettinger <python@rcn.com>
Sat, 4 Apr 2009 08:46:58 +0000 (08:46 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 4 Apr 2009 08:46:58 +0000 (08:46 +0000)
Lib/collections.py

index fb53900934681b8cf5260411c4830aec05509a20..1e83a908f39e3600c2328b75ac227e781f291e21 100644 (file)
@@ -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