4 ms·
Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, a
by tantalor 10y ago
Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of position index.
https://docs.python.org/2/library/collections.html#collections.namedtuple https://docs.python.org/2/library/collections.html#collectio...
- sevensor 10y agoNamed tuples are pretty great! I used to think their immutability was a drawback, but I'm starting to come around to the opposite point of view.