Kaydet (Commit) ff72816b authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Supply a reduce method for pickling.

üst 426e052a
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment