commit | ff72816b5fad9909c9e8ba4144d258b4595bbaca | [log] [tgz] |
---|---|---|
author | Raymond Hettinger <python@rcn.com> | Mon Jan 03 02:44:14 2011 +0000 |
committer | Raymond Hettinger <python@rcn.com> | Mon Jan 03 02:44:14 2011 +0000 |
tree | 01c2d2cb70e72fccac9da782333406474b6c14cf | |
parent | 426e052a4f60f94f3d97c95ce8477b967a975b3b [diff] [blame] |
Supply a reduce method for pickling.
diff --git a/Lib/collections.py b/Lib/collections.py index f26c73e..89a1588 100644 --- a/Lib/collections.py +++ b/Lib/collections.py
@@ -539,6 +539,9 @@ '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: