4 ms·
Since lists are mutable, I can pass them around to functions as arguments, similar to C and perform operations without bothering to return the list. But if a fu
by hoppla 5y ago
Since lists are mutable, I can pass them around to functions as arguments, similar to C and perform operations without bothering to return the list. But if a function would do listA = listA + listB, I am not sure what listA would be outside the function scope… I am guessing listA would remain unchanged
- mark-r 5y agoYou are correct. Inside the function you reassign listA but that doesn't change anything outside the function; you now have two different lists. See https://stackoverflow.com/q/986006/5987 https://stackoverflow.com/q/986006/5987.