Please, stop pushing for static typing in Python
I&#x27;m a bit surprised at the vitriol here for even just type hints, much less even static typing. I&#x27;ll admit that static typing is probably more pain than most python devs are willing to pay, but I will die on the hill of type <i>hints</i> being an essential contribution to the language that vastly improves its capabilities.<p>But don&#x27;t take it from me, take it from the people who wrote urllib3 [1], who insist that typing is even more powerful than unit tests--and they&#x27;re the developers of a wildly popular library. &quot;People are making it harder to develop without [type hints]&quot; you say, completely ignoring the productivity boon that the type hints have provided to many other people. (I&#x27;m also not clear on how the existence of type hints makes it harder to develop without them.)<p>In my personal experience, adding type hints and enforcement to our code has eliminated entire classes of runtime errors, and I find that developing with them makes my life significantly easier. I&#x27;ll admit some of that may be because dev tools are leaning on the hints, but I ask what&#x27;s the alternative? You can&#x27;t static-analysis your way to a definitive type in a dynamic language.<p>I&#x27;ll try to respond point by point:<p>&gt; I don&#x27;t want ugly rust-like typing. [...] It looks horrible in Python.<p>You don&#x27;t want a feature because... it looks bad? I could understand if it&#x27;s &quot;confusing&quot; or &quot;unclear syntax&quot; or &quot;makes it harder to read&quot;, but just &quot;ugly&quot; I have trouble both believing and understanding.<p>&gt; 2. Requires additional knowledge to implement correct type hints. [...] It is even getting hard to track the changes without including typing.<p>I&#x27;ll admit I&#x27;m not certain what you mean here. Typing is an optional feature, you don&#x27;t have to use it in your own code. I would also personally expect that knowing the types of the things you&#x27;re working with (e.g. via hints) would make it easier to hint your own code--but again, that&#x27;s even optional to do.<p>I&#x27;m not sure what you mean by &#x27;tracking the changes&#x27;--Could you elaborate on that?<p>&gt; 3. It encourages bikeshedding on features useless to the core language.<p>I&#x27;ll grant that adding typing to python opens up a whole new class of things for people to grouse about in mailing lists and on forums, and could even be pulling effort away from the core libs: but, python being an open-source open-contribution system, I&#x27;m amused that you&#x27;re taking issue with people who&#x27;re taking time and effort to contribute to the language simply because they aren&#x27;t contributing in the way that <i>you</i> want. Sure, it&#x27;s reasonable for the community to provide feedback to the creators,<p>There&#x27;s also the obvious comparison to Typescript, which is widely heralded as a massive improvement to Javascript--or at least enough of an improvement to have drunk who knows how many billions of dollars in developer-effort from Facebook and Microsoft because it&#x27;s so much of a force-multiplier. While python shouldn&#x27;t blindly follow other languages for the hell of it, I do think it&#x27;s paramount to sticking ones head in the sand to ignore the transition of the Javascript ecosystem, absolutely THE largest dynamically-typed language, to a statically-typed variant.<p>&gt; 4. It creates a rift in the language.<p>This, I&#x27;ll grant: if we moved to a fully static python, there&#x27;d likely be massive compatability issues throughout the ecosystem as library A adopted static types, but not library B. We already have some of this (as people note in other HN threads [2], though they&#x27;re definitely in the minority) as you pile on libraries with just type hinting, but it <i>is</i> improving as type hints become more and more popular.<p>&gt; 5. It affects startup performance<p>I&#x27;m assuming this is about static typing; type hints themselves have negligible performance impact. Or at least, in my experience they&#x27;ve been totally negligible (compared to just loading large untyped libraries), and I&#x27;d love to see if you have examples to the contrary. There&#x27;s plenty of ways for static typing to be done without impacting startup performance, or indeed for static typing to be a performance GAIN (as there&#x27;s classes of issues the VM won&#x27;t have to handle, or we can emit more efficient bytecode, etc etc--see also, optimizing compilers).<p>----<p>Overall, I think you make a lot of claims that require some amount of evidence to back up, especially when there&#x27;s so many examples of type hints being an absolute boon to people, both individual developers and maintainers of popular libraries. &quot;Useless typing PEPs&quot; and &quot;Manpower is wasted on something the majority of Python developers and applications don&#x27;t really benefit from&quot; and even citing type hints as adding complexity to newbies when it&#x27;s a <i>completely optional feature</i>? I can&#x27;t bring myself to believe these claims in the face of the community&#x27;s counter points and my massive opposed experience.<p>Type hints in python are a joy for me, coming from Rust and Swift and C++ and Typescript. I can remember when python was hell because you&#x27;d get hours into a run of a program and then the whole damn thing would come down because of a mismatched type. Having that extra bit of static analysis to ensure things worked properly is wonderful. The very first thing I did in my new role at my current company was to progressively typehint things and slowly fix the mypy errors, which led to 50% reduction in error rate in the application and, eventually, a speed increase in the order of three magnitudes. None of that would be possible if I didn&#x27;t have type hinting.<p>And, yes, your original premise is around <i>static</i> typing, I know, but you expend considerable electronic ink against the hints as well, and one begets the other.<p>Overall, your points read more like resisting change for the sake of resisting change than substantive issues with the system.<p>[1]: <a href="https:&#x2F;&#x2F;sethmlarson.dev&#x2F;blog&#x2F;tests-arent-enough-case-study-after-adding-types-to-urllib3" rel="nofollow">https:&#x2F;&#x2F;sethmlarson.dev&#x2F;blog&#x2F;tests-arent-enough-case-study-a...</a><p>[2]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26530381" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26530381</a> (but also check the whole parent discussion)