News for hackers. Stuff that matters.
Re:Reasons to avoid static type checking by nmca on Sunday January 28, 2024 @01:20AM (#39163038)
I eagerly await ruff-but-for-type-checking. Python type checkers are all excruciatingly slow at the moment.
Re:Reasons to avoid static type checking by diarrhea on Sunday January 28, 2024 @01:49AM (#39163151)
Yep. Speed is one factor, but also standardisation.

I’ve always been using mypy, but heard good things about pyright. It’s what VSCode uses by default as well, unless you jump through hoops. So I have pyright in the IDE and mypy everywhere else, yet they don’t agree with one another in various cases. Exhaustiveness checking and type inference in structural pattern matching, and async TaskGroups are some examples. One of my code bases has mixed “type: ignore” and “pyright: ignore” (forget the exact syntax) for that reason. Pretty bizarre and not something you’d see in any other language!

I wonder why mypy isn’t the blessed standard and pyright was able to catch up on (and in parts overtake) it. Mypy had a large head start and enjoys tons of development effort. Good job to Microsoft I suppose?

Re:Reasons to avoid static type checking by imron on Sunday January 28, 2024 @03:19AM (#39163523)
Use dmypy - the daemon version of mypy (installed when you install mypy) that runs 10x the speed for local edits/changes.

https://mypy.readthedocs.io/en/stable/mypy_daemon.html

(But I also await ruff type checking)