[Python-checkins] r71128 - python/branches/py3k/Lib/collections.py
raymond.hettinger
python-checkins at python.org
Sat Apr 4 10:48:03 CEST 2009
Author: raymond.hettinger
Date: Sat Apr 4 10:48:03 2009
New Revision: 71128
Log:
Replace the localized min/max calls with normal if/else
Modified:
python/branches/py3k/Lib/collections.py
Modified: python/branches/py3k/Lib/collections.py
==============================================================================
--- python/branches/py3k/Lib/collections.py (original)
+++ python/branches/py3k/Lib/collections.py Sat Apr 4 10:48:03 2009
@@ -461,10 +461,10 @@
'''
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 @@
'''
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
More information about the Python-checkins
mailing list