Why is "int + string" possible in statically-typed C# but not in dynamically-typed Python?
- by Salvador Dali
While studying C# I found it really strange, that dynamically typed Python will rise an error in the following code:
i = 5
print i + " "
whereas statically typed C# will normally proceed the similar code:
int i = 5;
Console.Write(i + " ");
I would expect other way around (in python I would be able to do this without any casting, but C# would require me to cast int to string or string to int).
Just to highlight, I am not asking what language is better, I am curious what was the reason behind implementing the language this way.