Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98baa14 commit 4ce5f3fCopy full SHA for 4ce5f3f
1 file changed
Lib/copy.py
@@ -221,17 +221,15 @@ def _deepcopy_list(x, memo):
221
d[list] = _deepcopy_list
222
223
def _deepcopy_tuple(x, memo):
224
- y = []
225
- for a in x:
226
- y.append(deepcopy(a, memo))
+ y = [deepcopy(a, memo) for a in x]
227
# We're not going to put the tuple in the memo, but it's still important we
228
# check for it, in case the tuple contains recursive mutable structures.
229
try:
230
return memo[id(x)]
231
except KeyError:
232
pass
233
- for i in range(len(x)):
234
- if x[i] is not y[i]:
+ for k, j in zip(x, y):
+ if k is not j:
235
y = tuple(y)
236
break
237
else:
0 commit comments