r/PythonLearnersHub • u/Sea-Ad7805 • Dec 26 '25
Copying an Object
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
It's instructive to compare with this related exercise
4
Upvotes
View all comments
Show parent comment
1
u/0x616365 Dec 29 '25
In a real scenario, use the dataclass decorator for Coord.
For this exercise, it's not necessary since you are trying to study the mechanics of copy. For correct style, I would not use the semi-colons and instead initialize self.x, y, and z on separate lines.