News for hackers. Stuff that matters.
Re:Python Modern Practices by eesmith on Wednesday July 03, 2024 @12:27AM (#40862690)
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.

There are no comments on this comment yet.