by LtWorf · 3y ago · 0 comments
It makes refactor much easier, I can easily understand what parameter a function wants, without having to read the docstring or worse, the body of the function.
typecheckers do find a lot of errors that would otherwise be runtime errors.
This is a claim I see repeated over and over without much evidence to support it. In my experience type checkers find a lot of errors that would still be found at later stages and a lot of tiny errors that don't matter and can be dealt with via much cheaper tools.
Shorter feedback cycle is nice, and occasionally it does catch a real bug, but the benefits of static typing are vastly overblown.
There probably are teams where typecheckers do catch a lot of important runtime errors. Those are the teams with a horrible engineering culture. In those environments typecheckers are a bandaid, not a cure. If anything, they are hiding the real problem: you shouldn't give a perfume to someone who doesn't shower.
It's bad, really really bad.
Refactoring can be done just as well via a good IDE and unit testing.
Using typechecking creates far more errors then it finds. They are a necessary evil in compiled languages. It's been measured that it creates more errors. That is not open for debate.
I don't think you should be surprised. Untyped Python code is a lot shorter and more concise than typed Python code.
The easiest way by far to reduce the bug count is to reduce the lines of code.