Skip to content

Glossary: Data Structures and Algorithms

Key function

Also written: key=, key argument

A function passed as `key=` that gives the value to sort or compare by. Python calls it once on each item, as when sorting Sam's orders by their total.

Where the book teaches it

Related terms

LambdaStable sort