3 ms·
> lists aren’t immutable when passed to another function Well, lists are never immutable in Python; you want to use tuples for that.
by BerislavLopac 5y ago
> lists aren’t immutable when passed to another function
Well, lists are never immutable in Python; you want to use tuples for that.
- macintux 5y agoTrue, what I really want is referential transparency, not immutability per se. I’ve only used tuples in Python as a small data structure, will have to experiment with using them as a list substitute, thanks.
- BerislavLopac 5y agoJust keep in mind that a tuple's elements can still be mutable, so it's not a "frozen" data structure throughout.