News for hackers. Stuff that matters.
Re:Ty: A fast Python type checker and language server by maleldil on Thursday May 08, 2025 @01:39PM (#43928898)
The dataclass decorator isn't there to make the type checkers understand the class. Its main purpose is to automatically implement trivial methods like the constructor, equality, repr, etc. The type hints make this more convenient, but something similar already existed with attrs.
Re:Ty: A fast Python type checker and language server by bvrmn on Friday May 09, 2025 @02:50AM (#43934401)
It's literally stated in the PEP: https://peps.python.org/pep-0681/

Also: https://github.com/python/mypy/blob/501a07b45af8e44eda665e53...

Also did you know mypy ignores typing of class decorators? You simply can't return a different type other than type[thisclass].