3 ms·
Agreed, I use the fact that "namedtuples are tuples" constantly. For one thing, you can pass them to 3rd party libraries that take tuples while maintaining read
by hyperbovine 9y ago
Agreed, I use the fact that "namedtuples are tuples" constantly. For one thing, you can pass them to 3rd party libraries that take tuples while maintaining readability on your end. I would be horrified if they dropped index access. It would break everything.
I should say though, for simple POJO-style classes @attr.s (https://github.com/python-attrs/attrs https://github.com/python-attrs/attrs) has replaced 90% of my namedtuple usage.