mirror of https://github.com/python/cpython
Minor factoring
This commit is contained in:
parent
a185839862
commit
fdf1b5642b
|
@ -452,12 +452,11 @@ class Counter(dict):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
if iterable is not None:
|
if iterable is not None:
|
||||||
|
self_get = self.get
|
||||||
if isinstance(iterable, Mapping):
|
if isinstance(iterable, Mapping):
|
||||||
self_get = self.get
|
|
||||||
for elem, count in iterable.items():
|
for elem, count in iterable.items():
|
||||||
self[elem] = self_get(elem, 0) - count
|
self[elem] = self_get(elem, 0) - count
|
||||||
else:
|
else:
|
||||||
self_get = self.get
|
|
||||||
for elem in iterable:
|
for elem in iterable:
|
||||||
self[elem] = self_get(elem, 0) - 1
|
self[elem] = self_get(elem, 0) - 1
|
||||||
if kwds:
|
if kwds:
|
||||||
|
|
Loading…
Reference in New Issue