I am starting to learn Python and, as a developer first of all, Java, the biggest problem that I encounter is to understand when and when not to use type checking. Most people seem to say that Python code does not need type checking, but there are many cases where I find it necessary. For example, let's say I need to use a method parameter to perform an arithmetic operation, why not make sure that the argument is a numeric data type?
This problem is not limited to functions only. The same thought process arises for class variables. Why and when should I or should not use properties (using @property ) to check type instead of regular class variables?
This is a new way to approach development for me, so I would appreciate understanding.
source share