"monty" < "python"

Roy Smith roy at panix.com
Wed Mar 20 09:58:34 EDT 2013


In article <mailman.3561.1363786737.2939.python-list at python.org>,
 Jan Oelze <jan at codein.is> wrote:

> From the docs[0]:
> 
> "Strings are compared lexicographically using the numeric equivalents (the 
> result of the built-in function ord()) of their characters. Unicode and 8-bit 
> strings are fully interoperable in this behavior."

Note, however, that sorting order is a really complicated subject.  
Different languages have all sorts of rules for how to alphabetize 
entries in a directory or dictionary.  Does N sort the same as N?  Does 
E sort the same as E?  What about C and C?  Are these pairs all the same 
letter, one of which is decorated with some mark, or are they different 
letters?

If you're worried about these sorts of things, you need to be looking at 
the locale module.



More information about the Python-list mailing list