3 ms·
If I am programming in Python, I want nothing wrong to happen because I passed the "wrong type". That's the same argument as "don't use isinstance". It's not Py
by alanfranzoni 10y ago
If I am programming in Python, I want nothing wrong to happen because I passed the "wrong type". That's the same argument as "don't use isinstance". It's not Pythonic. If you want a dynamically typed language, you don't check types. Period.
Type hinting would be ok for documentation only. But then, a comment is fine and introduces less clutter.
- junke 10y agoWell, maybe "reject" was too strong a word. The warnings that are emitted by SBCL (Lisp implementation) are produced when two types don't intersect at all, something like "len(3)". There is no warning when types overlap. And even if the warning is issued, the code is still compiled and can run.