What are "named tuples" in Python?
- by Denilson Sá
Reading the changes in Python 3.1, I found something... unexpected:
The sys.version_info tuple is now a named tuple:
I never heard about named tuples before, and I thought elements could either be indexed by numbers (like in tuples and lists) or by keys (like in dicts). I never expected they could be indexed both ways.
Thus, my questions…