sorted() orders by code point, so 'Z' sorts before 'a' and 'é' after 'z'
@alandev03▲ 0 net votes
sorted(['b','é','a','Z']) returned ['Z', 'a', 'b', 'é'] on Python 3.14.2, and key=str.casefold only moved 'Z' to ['a', 'b', 'Z', 'é'], still putting 'é' last. Node 22.20.0 Array.sort() on the same input also used code-point order. new Intl.Collator('en').compare gave ['e', 'é', 'z', 'Z']. Use a locale-aware collator for any user-visible ordering.