I'm glad for the improvements to typing and the new data classes. Here's hoping that the recent push for optional static checking will prove helpful to those building larger apps using Python.
It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!
CPython 3.6 has ordered dictionaries, but that is an implementation detail. 3.7 guarantees it in the spec. So it’ll work for CPython 3.6 which is the most popular implementation by far.
Yes that’s correct. When people talk about python they’re overwhelmingly referring to CPython. Other implementations like Pypy and micropython would not have to have ordered dictionaries for their 3.6 but they would for their 3.7.
I mean they all could, but are not guaranteed to. You have to check implementation detail for each individually. But in 3.7 and above no matter what you use, you will have it.
To me, a non-Python user, this whole type checking this is hilarious and farcical. Python is made with dynamic typing as a feature and it's lack of type checking (at least until run time) is one of it's strengths. To now start static type checking - why even bother; you may as well use a real language with first class static typing support. Bolting it on as an after thought still makes me laugh hehe.
I haven't used Python's typing (mypy?), but... options are good, no? Like, you don't have to use mypy if you don't want to. But Python has a lot of strengths, and if someone wants to use those strengths but also get types, what's wrong with that?
While I haven't used mypy, I've used TypeScript a ton, and if mypy is half as good as TypeScript, I'm glad it exists.
Python is made with dynamic typing as a feature and it's lack of type checking (at least until run time) is one of it's strengths.
Dynamic typing is the easiest type system to implement in languages, and that's why scripting languages tend to prefer it. It has very significant costs, and the supposed benefits to the programmer are dubious at best. Static typing is technically better for a large number of reasons, but lately programmers have adopted the idea that "easy" is favorable over "good".
Dynamic vs. Static is not a question of what is better, it's a question of what problem you are trying to solve.
Do you need a lot of small highly flexible purpose-built scripts in an environment where the same data is likely to be passed around many formats (e.g. The Web)? Dynamic good. Static bad.
Do you need large rigorous algorithms, high performance, do you expect to share your tools, do you need more control under the hood? Static good. Dynamic bad.
Making Python able to do both is great for Planet Python. It's also extremely difficult to implement. Dynamic typing systems aren't easier to implement than static ones, it's just that it's a very early design decision that impacts a lot of how the compilers are written. Trying to do both is what is truly challenging. While this is an impressive thing for any language, it also creates a bit of an identity crisis and potentially puts in danger of becoming bloated.
For me, personally, if I'm at a point in my Python project where I'm thinking that I need a strong static type-system, that's the point where I say to myself, "Python wasn't the right tool for this job." Of course I've also started projects with static typing and later regretted the loss in flexibility upon realizing that the project has no need for static typing.
340
u/[deleted] Jun 28 '18
I'm glad for the improvements to typing and the new data classes. Here's hoping that the recent push for optional static checking will prove helpful to those building larger apps using Python.