Why does Python not perform type conversion when concatenating strings?

The problem is that the conversion is ambiguous, because + means both string concatenation and numeric addition. The following question would be equally valid:

Why does the Python interpreter not automatically try using the int() function when it encounters addition of these types?

This is exactly the loose-typing problem that unfortunately afflicts Javascript.

Leave a Comment