by hellofunk · 8y ago · 0 comments
Gradual typing in Python is a happy medium that lets the developer decide (to some degree) on the workflow up front. It's a nice compromise for a wide range of work.
I love this explanation from a few months ago:
https://blog.merovius.de/2017/09/12/diminishing-returns-of-s...
This is not the indisputable fact that you seem to be portraying this as. I've written similar amounts of Rust and Python, and it is much much easier and faster for me to write robust software in Rust than in Python. Python might let me get to a prototype more quickly in some cases, but the amount of time spent on maintenance after the fact puts Rust very clearly in the lead in my experience.
There's no doubt that Rust's learning curve is much much steeper than Python's, but this is a very different thing that saying something general about overall development cost.
The nice thing about gradual typing is if you get to a proof-of-concept, you can then layer in types for static analyzers to make it more robust. Sure it's not Rust-level safety, but it works for very demanding projects. Heck, all of Instagram is built on Python, and they use the static type analysis in their workflow just like this.
It's just a compromise everyone needs to find on their own or for a specific project.
I'm personally not a huge fan of gradual typing. I've tried it, and it didn't work well for both technical and social reasons. But I'm not here to argue that point.
I don't buy this argument. If you want your program to do what you intend you have to know the types anyway. I've never spent significant time on finding the right type, even in Rust.
I have spent significant time on incorrect code, because of functions that accepted inputs with the wrong type and didn't complain, because the wrong type had the same method.
I have spent significant time on looking up what a function can do, because the IDE can't figure out what my parameter is.
I have spent significant time on programs that ran into runtime problems every once in a blue moon that would have been easily detected by a good type system at compile time.
Articles like this just show me that every language that needs to have maintainability for large projects will turn into strongly, statically typed at some point. Whether it's type hints or TypeScript.