3 ms·
Actually, I consider the immutability of a `namedtuple` instance to be a benefit. I wish more things in Python were/could be immutable. I have been known to s
by kiwidrew 10y ago
Actually, I consider the immutability of a `namedtuple` instance to be a benefit. I wish more things in Python were/could be immutable. I have been known to subclass `tuple` from time to time when I want both immutability and the ability to define methods.
I wince when I see `namedtuple` being subclassed. Most users don't realise that the implementation of it actually builds up a giant string to pass to `eval()`... thoroughly nasty! At least it's hidden underneath the covers for the most part.