News for hackers. Stuff that matters.
Re:Redesigning Python's named tuples by joejev on Friday September 01, 2017 @02:15AM (#15146525)
One advantage of namedtuple is that it is just a tuple! You can pass the namedtuple to code that expects a tuple, even C code that expects a tuple. This makes it easy to add names to tuples after the fact without breaking existing code.

In one project, I use a Point2D class as a namedtuple. Because it is just a tuple, I can easy convert it to a numpy array when working with a collection of points.

There are no comments on this comment yet.