Hacker News new | ask | show | jobs
by eesmith 712 days ago
Yeah, I think namedtuple's popularity (recommended in this link) was a mistake. It's sole modern use case should be to turn tuples used as an unnamed struct into a named struct while preserving tuple indexing for backward compatibility.

Most people don't need, say, a[-3] as an alias for a.field_name.

Otherwise, for those who want the standard library, use a dataclass with frozen=True for immutability.