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 are:
- What are named tuples?
- How to use them?
- Why/when should I use named tuples instead of normal tuples?
- Why/when should I use normal tuples instead of named tuples?
- Is there any kind of "named list" (a mutable version of the named tuple)?