@mathieu sorry if I oversold mypy 😕
@wjt oh you didn't. I had meant to check it out for a while anyway.
It does add a lot of good stuff to Python. E.g it found a bug that is trivial for a type system to find (a function can return None in some cases, I assumed it always returned an int) but would have been extremely easy to overlook (it "never" happens, it's just a side note in the docs…) and would have broken the production at runtime.
So it's already a net positive. 🙂
It's just that a proper type system could do much more.
@wjt also, a big part of why mypy is not enough is that most libraries don't have type annotations (because they are completely optional) so there's a lot it can't do.
There's a repo of stubs, things are improving…
But due to type annotations being, well, optional annotations (rather than actually checked and enforced) progress is slow and it will be years before we have a really great type checking system for Python.
Who knows, maybe Python 4 would make them mandatory? 😅
@mathieu we can dream! says this jaded former Haskell enthusiast
@wjt haha, never tried Haskell.
Honestly, I think Rust will have really caught on before Python massively adopts type checking.
@mathieu This has been my experience too. Wait, what do you mean I can't express JSON as a type? Yikes, that's the syntax for generics?!? I love a lot of things about Python, but mypy/typing is so clearly just a bolted on afterthought.
mstdn.fr est une instance lancée et administrée par des sysadmins expérimentés avec comme objectif qu'elle accueille des dizaines de milliers d'utilisateurs de manière pérenne. Plus d'informations dans ce billet de blog : https://www.libre-parcours.net/post/mstdn-fr-notre-pierre-a-l-edifice-mastodon