In brief
operator.itemgetter('price') creates a function that retrieves the specified key. It can serve as the key argument to sorted() instead of another small custom function.
Useful to know
operator.itemgetter('price') creates a function that retrieves the specified key. It can serve as the key argument to sorted() instead of another small custom function. [1]
First check that records contain comparable prices. Retrieval neither converts text to numbers nor supplies missing keys. If sorting needs a secondary criterion, include it in the explicit rule rather than relying on an accidental property of the input.
Sources
For further detail and to check the information: