4 ms·
Python has type annotations since 3.5 and you can get static type checking via mypy. This is a type system that works quite well IMHO and eleminates most of the
by Rotareti 8y ago
Python has type annotations since 3.5 and you can get static type checking via mypy. This is a type system that works quite well IMHO and eleminates most of the issues you mentioned.
- kod 8y agoThe main benefit of Python is the ecosystem of libraries. Those libraries don't have type annotations. Mypy is a far cry from a real statically typed language.
- weberc2 8y agoThere is typeshed for stubbing libraries that don’t have their own annotations, but there are still several popular libraries that can’t be annotated—like SQLAlchemy or boto—because they generate their own types at runtime.
- theshrike79 8y agoThe problem is that WAY too many projects are still on Python 2.x. Either some weird support library hasn't been upgraded to 3.x yet or some expensive piece of software/hardware can't be accessed with Python 3.x
- garettmd 8y agoHave you used Python and Python libraries recently? That used to be the case, but ever since the Python 2 "death clock" has started this has become a fairly rare occurrence, except in some specific domains.
- weberc2 8y agoAs someone who does most of their professional development in Python, I’ve been eagerly waiting for something like Mypy, but my experience with it has been really disappointing and frustrating compared to languages like Go. Mypy mostly seems immature, buggy, and completely unergonomic (typing support was shoehorned into the syntax so most things chafe—declaring a type variable or a callable that takes args and kwargs). Python needs a better static typing story in order to be a productive language in medium-to-large-sized projects.
- Rotareti 8y agoAs someone who works full time in Python and TypeScript, I find the typing experience quite similar in both languages. You can be "productive" in both languages "in medium-to-large-sized projects". > Mypy mostly seems immature, buggy ... That was my experience some time ago as well, but it's getting better from release to release. Look at the repo [0], it's continuously improving. I find Mypy deserves more recognition. The same guys working on mypyc [1], which I think is very interesting too. [0]: https://github.com/python/mypy/graphs/contributors https://github.com/python/mypy/graphs/contributors [1]: https://github.com/mypyc/mypyc https://github.com/mypyc/mypyc
- weberc2 8y agoThat’s great to hear. It’s been a while so I should go back and try it again!