`operator.itemgetter` and `attrgetter` get under-used IMO. Same goes for `else` clauses on `for` and `while` loops.
Brett Cannon
Python Tip #148 (of 365):
Sort by specific sequence items with operator.itemgetter 🧵
Have an iterable of sequences (tuples, lists, etc.)?
You can sort them by one or more of their indexes using itemgetter from Python's operator module.
from operator import itemgetter
#Python #DailyPythonTip