home.social

#shallowcopy — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #shallowcopy, aggregated by home.social.

  1. 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: memory-graph.com/#codeurl=http
    - Explanation: github.com/bterwijn/memory_gra

    If you think this could help Python students and educators, please boost.

  2. 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: github.com/bterwijn/memory_gra

    🎥 See the Quick Intro video for the VS Code setup: youtu.be/23_bHcr7hqo