[Python-checkins] r87672 - python/branches/py3k/Lib/collections.py
raymond.hettinger
python-checkins at python.org
Mon Jan 3 03:44:14 CET 2011
Author: raymond.hettinger
Date: Mon Jan 3 03:44:14 2011
New Revision: 87672
Log:
Supply a reduce method for pickling.
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 Mon Jan 3 03:44:14 2011
@@ -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:
More information about the Python-checkins
mailing list