diff options
author | Raymond Hettinger <python@rcn.com> | 2011-04-20 20:03:49 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-04-20 20:03:49 (GMT) |
commit | fc330aeb6f6968d1b843b47c8d7f36a708eb5b0c (patch) | |
tree | 10e6daed780574fbb2eb955f310fdb830afdcfc7 /Lib/collections.py | |
parent | c3ab577f347b290e1af37e5bd7748e8d3f5c2589 (diff) | |
download | cpython-fc330aeb6f6968d1b843b47c8d7f36a708eb5b0c.zip cpython-fc330aeb6f6968d1b843b47c8d7f36a708eb5b0c.tar.gz cpython-fc330aeb6f6968d1b843b47c8d7f36a708eb5b0c.tar.bz2 |
Minor text rearrangement.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r-- | Lib/collections.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index 79912ec..b2a590b 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -98,16 +98,6 @@ class OrderedDict(dict): yield curr.key curr = curr.prev - 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,) - update = __update = MutableMapping.update keys = MutableMapping.keys values = MutableMapping.values @@ -156,6 +146,16 @@ class OrderedDict(dict): self.__in_repr = False return result + 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) |