This was probably the most confusing thing in Python when I started, and the docstring of sorted never helped :)
It does feel like magic! I actually went to check what the docstring says. It’s just this: “A custom key function can be supplied to customize the sort order”. Not that helpful unless you already know what key does!
Yes, that's cryptic for a beginner. They should do better.
This was probably the most confusing thing in Python when I started, and the docstring of sorted never helped :)
It does feel like magic! I actually went to check what the docstring says. It’s just this: “A custom key function can be supplied to customize the sort order”. Not that helpful unless you already know what key does!
Yes, that's cryptic for a beginner. They should do better.