mirror of https://github.com/python/cpython
Supply a reduce method for pickling.
This commit is contained in:
parent
426e052a4f
commit
ff72816b5f
|
@ -539,6 +539,9 @@ class Counter(dict):
|
|||
'Like dict.copy() but returns a Counter instance instead of a dict.'
|
||||
return Counter(self)
|
||||
|
||||
def __reduce__(self):
|
||||
return self.__class__, (dict(self),)
|
||||
|
||||
def __delitem__(self, elem):
|
||||
'Like dict.__delitem__() but does not raise KeyError for missing values.'
|
||||
if elem in self:
|
||||
|
|
Loading…
Reference in New Issue