3 ms·
I literally said it supports exhaustive pattern matching which adds a level of safety and flexibility superior to that of type script. Many IDEs have real time
by corethree 3y ago
I literally said it supports exhaustive pattern matching which adds a level of safety and flexibility superior to that of type script.
Many IDEs have real time type checking that highlights the errors so don't even have to run the external checker.
Even if you don't use IDEs running the type checker is measured in seconds. Not far off from linters that most people will also use for TS.
What you say about the libraries is true though. But you can always place a type "shell" around those libraries such that your code is type safe.
The other main problem with the libraries in python is that a lot of people who use python are data scientists who haven't figured out why types are so great. Those guys are the main ones holding the libraries back.
- chlorion 3y ago>I literally said it supports exhaustive pattern matching which adds a level of safety and flexibility superior to that of type script. I don't have an opinion on which language is superior here, I've never written typescript or even javascript before, but I think saying that python's type system/checkers is superior because of this one feature is not correct. I'm also skeptical of the claim that typescript doesn't support exhaustive branching. This very well could be true but it seems hard to believe. I'm a big fan of exhaustive branching, but I think there are other things that are as or more important.
- corethree 3y ago>I don't have an opinion on which language is superior here, I've never written typescript or even javascript before, but I think saying that python's type system/checkers is superior because of this one feature is not correct. I meant, it supports basically every common/useful type feature in addition to this one which is very powerful. >I'm also skeptical of the claim that typescript doesn't support exhaustive branching. This very well could be true but it seems hard to believe. It is true. Look it up. Very few languages support this feature. Python is able to do it because the type checker is external so developers can create all kinds of features and move faster then core python development. But by default other then Rust, Rust is basically the only popular language that officially has this concept.
- seabrookmx 3y agoMaybe comprehensive is the wrong word to use. But Typescript is definitely more mature. I really like to run these checks alongside black, pyupgrade etc. in my CI pipelines. And under the hood your IDE is just running the same "external" checker and parsing it's results to provide it's smarts. As for performance, early mypy versions took literally minutes on a moderately sized FastAPI codebase I maintain. The team (which includes Guido himself!) literally created a new python native compiler (mypyc) to try and improve performance of the tool. I like types in Python but it's early days compared to a more mature tool like Typescript. IMO it's pretty clear cut if you've spent significant time using both.