Skip to content

Glossary: Python Beyond the Basics

key function

Also written: key=, sort key

A function passed as `key=` to `sorted`, `min` or `max` that Python calls on each item to decide what to compare. Pass the function's name without parentheses.

Where the book teaches it

Related terms

lambda