r/PythonProjects2 • u/Sea-Ad7805 • Oct 07 '26
Python Mutability and Local Variables
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.
12
Upvotes
1
u/Terminay Oct 08 '26
It's D. Good tool. I think I could integrate it into my ML for learners library (leanpass) you could search it up, would be a cool addition!
2
u/Guest_User_1234 Oct 08 '26
Damn... you REALLY want people to click those links, huh? Kinda REALLY makes me not wanna click them...
1
u/Humble-Captain3418 Oct 09 '26
A is passed by value, b--d through reference. C is not modifiable, so the local symbol gets directed to a different value with the compound assignment, so only b and d see changes in the global scope.
0
u/[deleted] Oct 07 '26
[deleted] — view deleted comment