I’m porting a Bash script to Python. The script sets LC_ALL=C and uses the Linux sort command to ensure the native byte order instead of locale-specific sort orders (http://stackoverflow.com/questions/28881/why-doesnt-sort-sort-the-same-on-every-machine).
In Python, I want to use Python’s list sort() or sorted() functions (without the key= option). Will I always get the same results as Linux sort with LC_ALL=C?
Sorting should behave as you expect if you pass locale.strcoll as the
cmpargument tolist.sort() and sorted():
But in Python 3 (from this answer):