2 ms·
I agree that namedtuples shouldn't be used if you don't actually want a tuple.
by icebraining 9y ago
I agree that namedtuples shouldn't be used if you don't actually want a tuple.
- raymondh 9y agoI concur :-) Otherwise, use a dict, types.SimpleNamespace, python-attrs, or a custom class. FWIW, the origin of namedtuple() was that some variation of it had been re-invented many times and this tool brought together the common features of those tools (substitutability for regular tuples, compact storage, usability as a dictionary key, named fields, a clear __repr__, etc.)