Idiomatic Python: Custom Sorts and Leveraging Sort Stability

Опубликовано: 25 Апрель 2026
на канале: MathByte Academy
676
43

In this video we look at how we can leverage Python's `sorted()` function to use custom sort keys, as well as how to leverage the sort stability for multi-step sorts. We look at the `attrgetter` and `itemgetter` functions in the `operator` module which can come in handy in this context, and look at timings of the various approaches.

#mathbyteacademy #python

Code for this Video
================
Available in GitHub blog repo: https://github.com/fbaptiste/python-blog
Direct link: https://tinyurl.com/2fz8msmr

My Python Courses
=================

Python 3 Fundamentals (introduction to Python)
https://www.udemy.com/course/python3-...

Python 3 Deep Dive (Part 1 - Functional)
https://www.udemy.com/course/python-3...

Python 3 Deep Dive (Part 2 - Iteration, Generators)
https://www.udemy.com/course/python-3...

Python 3 Deep Dive (Part 3 - Hash Maps)
https://www.udemy.com/course/python-3...

Python 3 Deep Dive (Part 4 - OOP)
https://www.udemy.com/course/python-3...