Benny K :
Is comparing two characters (that is one character str
) in Python (3.x if that matters) well defined? or do I have to make an explicit conversion?
In other words, is:
'a' > 'b'
the same as:
ord('a') > ord('b')
Ondrej K. :
When not sure, check the docs:
Strings (instances of
str
) compare lexicographically using the numerical Unicode code points (the result of the built-in functionord()
) of their characters.
So yes, the behavior is well defined.