4 ms·
> I think type obsession should stop . Typelessness is the bane of Python. The community would be wise to finally take it seriously instead of keep pretending
by rumanator 7y ago
> I think type obsession should stop .
Typelessness is the bane of Python. The community would be wise to finally take it seriously instead of keep pretending that type checking wouldn't fix whole classes of the bugs and lead to safer software, higher productivity, and overal better dev experience.
- marviel 7y agoYeah, I consider myself an advanced & "bought in"python programmer, but recently I've been dabbling in VSCode + Typescript and it is truly amazing how much more confident I am in the things I create, when I'm careful to use the type system and things like Union Types to my advantage. Python typing still lags behind, and my python code is the scarier for it. Also -- one gamechanger for me has been the addition of an IDE as the go-to environment for programming in strongly typed languages... having an IDE that "gets" the language you're coding in, and its types, has allowed me to eschew a huge number of my "todo" statements altogether -- as I'll add a signature / typename where I'm going to use it, and the compiler won't let you do anything until you've actually done what you asserted you were going to do.
- takeda 7y agoI use python's type annotations, but didn't use TypeScript, what kind of things you mean when saying that Python lags behind?
- tomnipotent 7y agoPython doesn't have a transpilation stage like TypeScript, which gives JS a sort of compile-time check that forces the developer to fix type errors. Python type hints can just be ignored.
- takeda 7y agoThat's a really silly argument. "TypeScript is better because I'm required to run the transplier" If you believe that type checking is necessary, you won't have problem running mypy. Also TypeScript has a transplier, because there was no other option, browsers use JavaScript and don't understand TypeScript so the conversion is necessary. Maybe that won't be needed in the future, but it is needed now.
- cwyers 7y agoA lot of people don't only work on their own code. They have dependencies, they have coworkers, they have to work on code they wrote nine months ago. So it's not "I need to be forced to use the type checker," it's "everybody needs to be forced to use the type checker."
- takeda 7y agoIf it's required, you add mypy to your CI. Have it run whenever a PR is submitted.
- tomnipotent 7y agoI have no idea what argument/point you're trying to make. The TypeScript workflows happens to include this amazing process where auto-complete and other features work on non-TS libraries/code for no other reason than someone decided to take the time to provide type information on something that otherwise wouldn't have it. In a repository/workflow that is easy for any developer to easily tap into. This is amazing. How did you jump to "TS is better" or some silly thing like that? TS build pipelines almost by default don't let developers build/commit code if a type definition isn't followed. This is a HUGE workflow step that isn't common with Python and type hinting. It makes a big difference. There is no Python equivalent of MyPy "headers" or type information for countless third-party libraries. I use flake8/Black as part of my Python development experience, but it still doesn't compare to what the TS community has been able to pull off.
- takeda 7y ago> The TypeScript workflows happens to include this amazing process where auto-complete and other features work on non-TS libraries/code for no other reason than someone decided to take the time to provide type information on something that otherwise wouldn't have it. In a repository/workflow that is easy for any developer to easily tap into. > This is amazing. The same thing I observe in Python and PyCharm. > TS build pipelines almost by default don't let developers build/commit code if a type definition isn't followed. This is a HUGE workflow step that isn't common with Python and type hinting. It makes a big difference. There is no Python equivalent of MyPy "headers" or type information for countless third-party libraries. I don't think I understand, could you give me an example. I don't see how types can work if no type information is provided.
- elisharobinson 7y agomy whole gripe with a strict type system , is that it does not need to be a language feature the same way tests/IDE dont need to part of the language. you can add them if you need it but it shouldnt be a center piece , what should always come first is the feature / tech spec. Python has a great type system aswell its objects all the way down. And you can mix and match how you see fit. If you have identified that type checking is crucial part of the tech spec as a sanity check or otherwise you can import type checkers(ie mypy) with a very focused api to solve that problem. And in my opinion type obsession obscures the techspec rather than clarifying it , and places a large burden when the question of changing the spec comes. The simple cognitive load of keeping track of all the int's which need to be made to str's can drain you and make you loose site of the functionality.