summaryrefslogtreecommitdiffstats
path: root/Lib/copy.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-06-02 18:55:56 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-06-02 18:55:56 (GMT)
commite0d4972acc8cfd4b8fb16c074a8031e50fab0f29 (patch)
treeb9a9286453c2ee4397618d4483679c3bc531f4b0 /Lib/copy.py
parent1fab9ee085755ed2f7abcf28794d7c20bd51a97a (diff)
downloadcpython-e0d4972acc8cfd4b8fb16c074a8031e50fab0f29.zip
cpython-e0d4972acc8cfd4b8fb16c074a8031e50fab0f29.tar.gz
cpython-e0d4972acc8cfd4b8fb16c074a8031e50fab0f29.tar.bz2
Replaced .keys() with dictionary iterators
Diffstat (limited to 'Lib/copy.py')
-rw-r--r--Lib/copy.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index 21be6bc..0180554 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -234,8 +234,8 @@ d[types.TupleType] = _deepcopy_tuple
def _deepcopy_dict(x, memo):
y = {}
memo[id(x)] = y
- for key in x.keys():
- y[deepcopy(key, memo)] = deepcopy(x[key], memo)
+ for key, value in x.iteritems():
+ y[deepcopy(key, memo)] = deepcopy(value, memo)
return y
d[types.DictionaryType] = _deepcopy_dict
if PyStringMap is not None:
@@ -335,8 +335,8 @@ def _test():
def __getstate__(self):
return {'a': self.a, 'arg': self.arg}
def __setstate__(self, state):
- for key in state.keys():
- setattr(self, key, state[key])
+ for key, value in state.iteritems():
+ setattr(self, key, value)
def __deepcopy__(self, memo = None):
new = self.__class__(deepcopy(self.arg, memo))
new.a = self.a