r/learnmachinelearning • u/Sea-Ad7805 • 11d ago
Python Mutability: tuple vs list
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.
4
Upvotes
View all comments
Show parent comment
8
u/crayphor 11d ago
I think it's more that += does a concatenation, then an assignment. It is not editing the tuple, it is creating a new tuple and assigning it as the value of the variable.