games
pages
posts

iconPython

Typing


One complaint about Python often is that it has no typing.
And, I agree, typing is a way to enforce some minimal documentation for any code (you know what type of parameters to pass to a function), and also to make sure that you can never accidentally pass the wrong type - at compile time.
So, the worst C++ code would still be better than the worst Python code, in this regard.
But, on the other hand, this means, even the best C++ code would still be complicated, and you'd have to mess with types and (therefore) templates. The best Python code however would simply document the types for its function and an exception would naturally be thrown when the type can't be handled, without even having to put any extra code. Everything would stay simple and clear.
My opinion here: Static typing is good, dynamic typing is better.