After doing a bit of , coming back to I miss having a proper type system. So much validation code/tests I have to write, which would be done for me by the compiler. 😣

Mypy is nice but it's far from enough unfortunately.

@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? 😅

· · Web · 1 · 0 · 0

@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.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!