3 ms·
> This still produces a runtime error, to make code maintainable you want to be able to check the types without having to run the program. I strongly disagree.
by kerkeslager 6y ago
> This still produces a runtime error, to make code maintainable you want to be able to check the types without having to run the program.
I strongly disagree. There are plenty of ways to write maintainable code. Static types can help, but it's quite possible to write maintainable code in dynamically typed languages.
And, for the record, running unit tests doesn't require me to run the whole program.
And, even if I never explicitly test types (assert isinstance(foo, str) is an antipattern anyway), behavioral tests of my code will turn up most type errors.
The obsession with checking types at compile time rather than 30 seconds later while running the unit tests doesn't serve anyone.