3 ms·
Python offers immutable data structures in addition to the mutable ones. Tuples are immutable, we've had namedtuple for a while, and now it's possible to write
by sevensor 8y ago
Python offers immutable data structures in addition to the mutable ones. Tuples are immutable, we've had namedtuple for a while, and now it's possible to write immutable data classes as well. As time goes by, I find myself using less and less mutability in Python. At this point I default to immutable structures, and I bring in mutable ones only if I need them for performance or there's no reasonable immutable alternative.
- macintux 8y agoTangentially, I was extremely annoyed to discover that tuple unpacking in function headers was removed with Python 3. Coming from Erlang, tuples were quite appealing, but that was frustrating.