I want to sort a list of named tuples without having to remember the index of the fieldname. My solution seems rather awkward and was hoping someone would have a more elegan
sorted(seq, key=lambda x: x.name) sorted(seq, key=lambda x: x.age)