32
Python's Data Model Explained through Visualization
(programming.dev)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
Let's look at the suspects.
b.append(), you add to the existing list. This mutates the current list. You can not be the culprit.
b = b + [], you join up lists, making a new list in the process, that then gets stored in variable b, without changing the original list that's still stored in variable a. You are not the culprit either.
No, the culprit must be someone that ambiguously looks both like a mutation and an instantiation.
Isn't that right, b += []? Because the culprit... IS YOU!