Yes. Alas, the term for that is not "immutable". "immutable" is an adjective, and applies to data structures, such as a tuple or frozenset. It is not an adverb, so it does not apply to actions, such as operators, or function calls. On a constructive note, perhaps the phrase you're looking for is "side-effect free".
As for the number of lists... You demonstrate that, after the concatenation, you really do have *three* lists, not one. I'm at a loss as to how to fix the title to reflect that.
Fair point! doing `combined.insert` was meant as an example of mutating the new list. You're right, it doesn't really prove that `winners` and `losers` are immutable. I just wanted to demonstrate that once `combined` has been created, and if you change it, it doesn't change the lists that were used to *create* the new list.
Comment
Yes. Alas, the term for that is not "immutable". "immutable" is an adjective, and applies to data structures, such as a tuple or frozenset. It is not an adverb, so it does not apply to actions, such as operators, or function calls. On a constructive note, perhaps the phrase you're looking for is "side-effect free".
As for the number of lists... You demonstrate that, after the concatenation, you really do have *three* lists, not one. I'm at a loss as to how to fix the title to reflect that.
Parent comment
Fair point! doing `combined.insert` was meant as an example of mutating the new list. You're right, it doesn't really prove that `winners` and `losers` are immutable. I just wanted to demonstrate that once `combined` has been created, and if you change it, it doesn't change the lists that were used to *create* the new list.