Python Static Typing

The cluster debates the effectiveness of Python's type hints and static typing tools like mypy in large projects, weighing benefits for code maintainability and safety against criticisms of dynamic typing limitations compared to languages like Go, Rust, and TypeScript.

📉 Falling 0.4x Programming Languages
3,155
Comments
19
Years Active
5
Top Authors
#8236
Topic ID

Activity Over Time

2008
5
2009
10
2010
27
2011
26
2012
63
2013
47
2014
66
2015
81
2016
116
2017
205
2018
168
2019
301
2020
245
2021
313
2022
419
2023
430
2024
264
2025
362
2026
7

Keywords

PITA e.g PHP FB JSON NoneType IMO IPO TDD XML python type typing typed static static typing language statically typed types statically

Sample Comments

btbuilder Feb 25, 2012 View on HN

I work on a team of about 10 people with Python on a pretty complex project. We have not experienced any typing issues in deployed code. I think this can be attributed to a combination of strong unit tests and type enforcement when constructing objects that are eventually serialized to the database. Python is stronger than some other dynamic languages at type enforcement too.I believe I would prefer compile time type checking, but when working with a lot of dynamic data structures (say, JSON

TeeWEE Dec 30, 2019 View on HN

I'm working on a big python project, working with 30+ developers on it.We've added type hints in most places. And it makes it a lot easier reading other people code and seeying their intentions.Code is read a lot more often than that its written. And just being more explicit in what it does makes it better.Also type hints allow for certain static verification, making the code quality better.The big thing i miss is: Python is not a pure typed language.Programming in Kotli

StavrosK Jun 11, 2020 View on HN

I'm really liking Python static types to the point where I don't write new programs without them. Give them a shot, they really help.

throwaway894345 Jun 17, 2020 View on HN

Python is trending toward types via support for type annotations. My extensive experience with Python and Go leads me to the conclusion that it’s very difficult to write even moderately complex and maintainable Python code at scale. This doesn’t mean that no one can make money with Python—far from it—only that they would make even more money via Go (iterate faster and spend less time fixing bugs). Of course this can’t necessarily be extended to other languages. C++ and Rust would not be a

da39a3ee Jun 24, 2021 View on HN

That's why he said "better". Have you used bothA. python with type hintsandB. Typescript, or a statically typed language such as Rust/Java? I'm guessing not.

eweise Oct 27, 2022 View on HN

Seems like any statically typed language would be a big win over python.

anyfoo Oct 21, 2024 View on HN

I don't feel it's so much typing. Especially for the clarity and, most importantly, safety and correctness I get back. I'd rather type 3 1/2 seconds more than debug a dumb type issue for half an hour.It gets really old to get something like "NoneType does not have blah" in a deeply nested, complicated data structure in python, but obviously only at runtime and only in that hard to hit corner case, when all you did is forget to wrap something in the right n

Rotareti Dec 25, 2020 View on HN

Python supports type annotations and static typing via mypy and co. I find statically typed Python is absolutely comparable to other statically typed languages. At least I don't feel much of a difference working with it compared to go, typescript.

m0zg Feb 17, 2020 View on HN

I'd like to see something based on a proper, high performance, statically typed programming language s.t. I could have a modicum of certainty that things would work when someone changes something. With Python, sadly, you don't know until you run things and hit error conditions dynamically. This is unacceptable in larger codebases.

packetlost Jun 26, 2024 View on HN

No. Python's static typing is a complete joke. The core tools are overly lenient by default and without enforcement of anything at runtime you will be bitten sooner or later. I've spent several years with a very large, fully type annotated codebase and it's just not sufficient.