Every language, human or programming, has some weirdness to it. And while others might hate on the language, I learned to accept and embrace it as is. However, sometimes we can do better by choosing a different option. Not necessarily a different choice, but a different version of the language. Well, more like a different interpreter perhaps. For instance, choosing Python3 over Python2.

Again, this is not because of hate towards a language. It is merely because of sometimes we can have a better option.

Comparison

In Python2 you can compare anything to anything. For instance, you can compare '123' as a string to 123 as a number.

'123' > 123
# True

The same with the max function.

max('123', 123)
# '123'

This is odd, and a source of bugs obviously.

This is not possible in Python3. If we tried the previous functions, we would get an error telling us that the comparison is not supported between instances of 'int' and 'str', which exactly what I would expect.

python3-error-comparison