We had an entire history of Python 2 without type hints. Why use them now?
We had an entire history of Python 2 without type hints. Why use them now?
Many of us in the python community know the benefits, and we’re simply changing our stack so python is as contained as possible, and dropping lower quality libraries for higher quality typed ones.
Many people in the Python community simply aren't writing those kinds of applications. They're writing applications where typing is not a benefit, it's a hindrance, so they don't use it, and Python makes that easy.
But often it can be helpful to know the shape of the input and the shape of the output. Eg are we working with a 2D,3D or ND array.
Before 3.11 it was not simple (possible?) To type this. But https://peps.python.org/pep-0646/ makes it possible. If somewhat clunky on the definition side.
This is not to make the general claim "Typing is a hindrance in parsing applications", or anything close. It's saying "the current static type system(s) available in Python would have made this Python library much worse".
And Python has a ton of newbies, college kids etc. Though this is also true of JavaScript.
As an industrial language/environment with best practices for very large codebases, it's really weak and I much prefer TypeScript despite the occasional tooling fatigue (has slowed down).
But a ton of money has been poured into JavaScript (v8) which really set that into motion.
Also, we've been using non-standard type hints for nearly all of python 2, they were just non-uniformly specified in docstrings and weren't easily referenced or introspected for tooling and IDE's to work with them.