r/Python_memory_graph • u/Sea-Ad7805 • Sep 12 '25
Python Mutability
See the Solution and Explanation.
r/Python_memory_graph • u/Sea-Ad7805 • Sep 12 '25
See the Solution and Explanation.
r/Python_memory_graph • u/Sea-Ad7805 • May 15 '26
r/Python_memory_graph • u/Sea-Ad7805 • Aug 15 '25
See the Solution and Explanation.
r/Python_memory_graph • u/Sea-Ad7805 • Aug 28 '25
Visualize your Python data structure with just one click: Linked List
r/Python_memory_graph • u/Sea-Ad7805 • Aug 25 '25
π§ Understand what your Python code is really doing by memory_graph visualization, despite the difficulties of the Python Data Model:
references
mutable vs immutable data types
function calls and variable scope
sharing data between variables
shallow vs deep copy
π§© For example, what is the output of this program?
import copy
def fun(c1, c2, c3, c4):
c1[0].append(1)
c2[0].append(2)
c3[0].append(3)
c4[0].append(4)
mylist = [[0]]
c1 = mylist
c2 = mylist.copy()
c3 = copy.copy(mylist)
c4 = copy.deepcopy(mylist)
fun(c1, c2, c3, c4)
print(mylist) # What do you expect?π₯ See the live demo in Memory Graph Web Debugger.
r/Python_memory_graph • u/Sea-Ad7805 • May 21 '26
r/Python_memory_graph • u/Sea-Ad7805 • May 25 '26
r/Python_memory_graph • u/Sea-Ad7805 • Jul 21 '25
Understanding and debugging Data Structures is easier when you can see the structure of your data using memory_graph. Here we show values being inserted in a Binary Tree.
π₯ See the Quick Intro video for the VS Code integration.
r/Python_memory_graph • u/Sea-Ad7805 • Aug 03 '25
See the Solution and Explanation.
r/Python_memory_graph • u/Sea-Ad7805 • Jul 21 '25
Changing a value of immutable type results in an automatic copy
Changing a value of mutable type causes it to mutate in place
π§ Understand the Python data model better using memory_graph.
π₯ Watch the explainer on Python Mutability.
r/Python_memory_graph • u/Sea-Ad7805 • Jul 21 '25
c1: assignment, nothing is copied, everything is 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 using memory_graph.
π₯ See the Quick Intro video for the VS Code debugger setup.
r/Python_memory_graph • u/Sea-Ad7805 • Sep 16 '26
r/Python_memory_graph • u/Sea-Ad7805 • Dec 13 '25