MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnmachinelearning/comments/1x89fg6/python_mutability_and_copying/phb1e4r/?context=3
r/learnmachinelearning • u/Sea-Ad7805 • Oct 17 '26
12 comments sorted by
View all comments
-1
a and b are both pointers to the same memory location.
copy.deepcopy() will copy a and create b in a separate memory location.
1 u/Sea-Ad7805 Oct 17 '26 Yes, see the shallow vs deep copy Explanation here: https://github.com/bterwijn/memory_graph#copying-values-of-mutable-typeBut what is your answer? 1 u/FastSlow7201 Oct 17 '26 d, but my answer was essentially in my original comment 1 u/Sea-Ad7805 Oct 17 '26 Incorrect sorry, see Solution link (in original post, click title) for correct answer.
1
Yes, see the shallow vs deep copy Explanation here: https://github.com/bterwijn/memory_graph#copying-values-of-mutable-type
But what is your answer?
1 u/FastSlow7201 Oct 17 '26 d, but my answer was essentially in my original comment 1 u/Sea-Ad7805 Oct 17 '26 Incorrect sorry, see Solution link (in original post, click title) for correct answer.
d, but my answer was essentially in my original comment
1 u/Sea-Ad7805 Oct 17 '26 Incorrect sorry, see Solution link (in original post, click title) for correct answer.
Incorrect sorry, see Solution link (in original post, click title) for correct answer.
-1
u/FastSlow7201 Oct 17 '26
a and b are both pointers to the same memory location.
copy.deepcopy() will copy a and create b in a separate memory location.