4 ms·
Dumb question from a non-developer: wouldn't using a dict object make more sense if someone wanted an unordered named tuple?
by tomrod 9y ago
Dumb question from a non-developer: wouldn't using a dict object make more sense if someone wanted an unordered named tuple?
- coldtea 9y agoIt's not about the storage (besides Python also has order dicts). Namedtuples are for the convenience of creating a record type (though indeed as others say, treating it as tuple where things expect a tuple is also a benefit).
- xapata 9y agoA dict is appropriate for labeled data. Currently unordered, but likely to keep insertion order in v3.7 and later. Don't call it an unordered namedtuple. That's confusing, because tuples are ordered.