diff options
author | Raymond Hettinger <python@rcn.com> | 2011-04-20 20:09:46 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-04-20 20:09:46 (GMT) |
commit | 4f438b7b00af492e8ee3f7724420f609fbdf4c4c (patch) | |
tree | d9ec44b4c87e513b2f4bae3385008e79c767c5a6 /Lib | |
parent | 9a747fd37613916715704c54739e596be466e7a9 (diff) | |
parent | 296d6d0cd697e4367fc2c9ed1ca08edacdc5dee9 (diff) | |
download | cpython-4f438b7b00af492e8ee3f7724420f609fbdf4c4c.zip cpython-4f438b7b00af492e8ee3f7724420f609fbdf4c4c.tar.gz cpython-4f438b7b00af492e8ee3f7724420f609fbdf4c4c.tar.bz2 |
Minor text rearrangement.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/collections/__init__.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index bb10352..c0c2180 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -152,16 +152,6 @@ class OrderedDict(dict): link.next = first root.next = first.prev = link - def __reduce__(self): - 'Return state information for pickling' - items = [[k, self[k]] for k in self] - inst_dict = vars(self).copy() - for k in vars(OrderedDict()): - inst_dict.pop(k, None) - if inst_dict: - return (self.__class__, (items,), inst_dict) - return self.__class__, (items,) - def __sizeof__(self): sizeof = _sys.getsizeof n = len(self) + 1 # number of links including root @@ -202,6 +192,16 @@ class OrderedDict(dict): return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, list(self.items())) + def __reduce__(self): + 'Return state information for pickling' + items = [[k, self[k]] for k in self] + inst_dict = vars(self).copy() + for k in vars(OrderedDict()): + inst_dict.pop(k, None) + if inst_dict: + return (self.__class__, (items,), inst_dict) + return self.__class__, (items,) + def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self) |