-
Notifications
You must be signed in to change notification settings - Fork 347
Open
Description
In section "Copying":
http://www.rafekettler.com/magicmethods.html#copying
Says:
When you want to deep copy an individual attribute, call copy.deepcopy() on that attribute with memodict as the first argument.
Official documentation for Python 3 says:
https://docs.python.org/2/library/copy.html#copy.deepcopy
If the deepcopy() implementation needs to make a deep copy of a component, it should call the deepcopy() function with the component as first argument and the memo dictionary as second argument.
So:
- It should be nice that the wording "first", "second", etc, match. It was a little bit confusing for me.
- At least as the way I do understand it, memodict doesn't seem to work as documented:
>>> memodict = {}
>>> data = {'a': [1,2,3]}
>>> from copy import deepcopy
>>> deepcopy(data, memodict=memodict)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: deepcopy() got an unexpected keyword argument 'memodict'
Thanks.
rszalski
Metadata
Metadata
Assignees
Labels
No labels