9 ms·
i think type obsession should stop . And more effort should be placed on performance optimization of exiting apis. but there is lot to be learned from LTS lifes
by elisharobinson 7y ago
i think type obsession should stop . And more effort should be placed on performance optimization of exiting apis. but there is lot to be learned from LTS lifestyle of other products like debian and redhat which allow community to be built around them.
- kstrauser 7y agoWhy's that? I love the type system. We're not dogmatic about it - like, no one's going to reject a PR because it doesn't have complete type coverage - but it's a seriously useful tool and has uncovered some long-hidden bugs in our code. From a tooling point of view, I love hovering over a function name and seeing the types of its parameters. PyCharm supported that, using what I consider to be ugly and janky docstring comments, but now every editing environment can provide that information.
- takeda 7y agoYeah, it also helps with auto-completion and makes refactoring reliable. From my experience type annotations in python are actually more reliable than types in Go.
- sethammons 7y agoCan you expand on that? I'm not familiar with type annotations, but I use Go daily. Aside from interface{} abuses, how can something be more reliable than accepting a type in Go? (int64, string, []byte, myType{})
- takeda 7y agoI basically had less issues when trying to refactor annotated python code in PyCharm than Go code in GoLand (if you're not familiar, both of these IDEs are made by the same company JetBrains). My belief is that it is a bit harder for IDE to determine which structs and interfaces should be changed, due to Go using "duck typing" (or more correctly called structural type system). The mypy uses nominal type system (similar to what you're used in C++, Java etc) by default but it also allows to implement duck typing in places where you need it through Protocols. Overall the type system is more powerful than the one in Go[1], it even includes generics =) Slightly unrelated, but when working with Go, I feel like the type always gets in my way. Go typing (similarly to Python) is strict and that's great, but Go trying to be low level it implements different sizes (int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64) it doesn't do implicit conversion like C, but it also doesn't implement generics, and stdlib only implements functions for one of the type. That means if you use anything else than int, int64, float64 in your program you'll be in a lot of pain and will be constantly casting the types back and forth. Having programmed in Python (with type annotations) and now at my current job in Go, I love Python. [1] https://docs.python.org/3/library/typing.html https://docs.python.org/3/library/typing.html
- 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.
- threatofrain 7y agoTypescript has transformed the JS community, even for those who aren’t in the TS community at all as most major libraries have community updated typing which your IDE can consume. You don’t have to do any typing to consume some of its benefits; someone else can pay that cost for you. You don’t even have to be aware that TS exists.
- thrower123 7y agoAn observation that is nearly impossible to make is that JS is something like 20 years behind the rest of the world in so many ways. Now that it has moved on from being a little glue scripting language and people are building complex software with it, all the same problems that Java or C++ or Unix have encountered in the past are coming home to roost, and more structure and tooling is required.
- tomnipotent 7y ago> You don’t even have to be aware that TS exists. I never thought of it this way, a very interesting insight. TS has introduced an entirely new type (pun intended) of FOSS that isn't even code, it's just header files to let you know what the inputs/outputs of things are.
- kamyarg 7y agoI like Python because it is dynamic but recently I have been catching at least one bug per PR whenever I changed an existing python code. I too was sceptical before using it and Python or the community does not enforce it. But it is indeed useful.