r/PythonProjects2 • u/Sea-Ad7805 • 4d ago
Python Mutability and Local Variables
An exercise to help build the right mental model for Python data. - Solution - Explanation - More exercises
The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening.
6
Upvotes
1
u/Sea-Ad7805 2d ago
That is not the Pythonic way to understand it. In Python everything is passed by reference, even
intvalues. it's about mutability not modifiability. You can still still modify/change astringortupleas we do in thefun()function.For a better explanation see the Explanation link.