Ruff author contrasts type inference: ty vs Mypy vs Pyright vs Pyrefly on one example

charliermarsh · x · 2026-12-02

Charlie Marsh (Ruff/Astral) uses an example from the ty 1.0 blog post to compare Python type checkers. satisfiesall conjoins an arbitrary number of predicates; ty infers validbatch needs an input that has a length and yields integers, accepting [1,2,3] but rejecting iter([1,2,3]). Meanwhile Mypy infers Never and rejects both calls, Pyright infers Sized and flags the call, and Pyrefly infers Sized | Iterable[int], accepting an iterator that fails at runtime — a clear showcase of diverging inference behavior across the four tools.

Original post →

More from coding & agent

coding & agent channel →