Re:Redesigning Python's named tuples
by gvx on Friday September 01, 2017 @01:26AM
(#15146335)
Namedtuple is used a lot in the standard library to return struct-like results which used to be returned as an actual tuple, so making them non-indexable would break a lot of code, some of which was written before namedtuple even existed.
[ Parent
| on HN ]
I did that analysis a day ago when this topic came up previously, at https://news.ycombinator.com/item?id=15136961 .
There are 13 locations in the standard library where a namedtuple was used to replace a tuple, where making them non-indexable would break code.
There are 8 locations where it's used as a shorter way to write a simple class. My point in that thread was that namedtuple should never be used this way.