Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

Python Sorting Gotchas: Strings vs Numbers, Mixed Types, Unicode, Stability, Multi-Key and NaN

Self-Hosting & Infra beginner 5 min read $0.01 Updated 2026-10-20

Tested outputs on Python 3.10: sorted of numeric strings, key=int, case-insensitive key, accents sorting after z, stable sort, descending-by-one-key tuples, TypeError messages for str and None, sort() returning None, and NaN breaking order.

Sort numbers stored as strings, mixed None values, case-insensitive text and multi-key rows correctly. See what Python does with lexicographic order, TypeError, accented letters, stability and NaN.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →