#shallowcopy — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #shallowcopy, aggregated by home.social.
-
How to Prevent Object Spread From Being Shallow
Spread copies only the first level.
-
How to Prevent Object Spread From Being Shallow
Spread copies only the first level.
-
How to Prevent Object Spread From Being Shallow
Spread copies only the first level.
-
How to Prevent Object Spread From Being Shallow
Spread copies only the first level.
-
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:
- Solution: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/memory_graph_videos/refs/heads/main/exercises/exercise10.py&breakpoints=13&continues=1&play
- Explanation: https://github.com/bterwijn/memory_graph?tab=readme-ov-file#python-data-modelIf you think this could help Python students and educators, please boost.
-
Python copies:
- c1: assignment, nothing is copied, all the values are shared
- c2: shallow copy, only the first value is copied, all the underlying values are shared
- c3: custom copy, you decide what is copied and shared
- c4: deep copy, everything is copied, nothing is shared🧠 Learn the right mental model to think about Python data: https://github.com/bterwijn/memory_graph
🎥 See the Quick Intro video for the VS Code setup: https://youtu.be/23_bHcr7hqo