3 ms·
What is “something reasonable”? In Pyhon you get a runtime error automatically if you perform an operation not supported by the object, e.g performing a mathema
by bazoom42 2y ago
What is “something reasonable”? In Pyhon you get a runtime error automatically if you perform an operation not supported by the object, e.g performing a mathematical operation on an object which is not number-like. This is out of the box behavior in a duck-typed language, just like a compile-time error is out of the box in a statically typed language.
Of course you need to test for NaN, Infinity etc because these are number-like but still invalid. But you also need to do that in a statically typed language.