3 ms·
> Both mypy and pyright will do that. This still makes me seethe. We have pip, poetry, conda, and more. The Python folks knew that multiple incompatible syst
by klyrs 4y ago
> Both mypy and pyright will do that.
This still makes me seethe. We have pip, poetry, conda, and more. The Python folks knew that multiple incompatible systems would arise from a grammar spec without a behavior spec. And here we are. Python doesn't do anything useful with the types, but third-parties are left to their own devices.
- dragonwriter 4y ago> The Python folks knew that multiple incompatible systems would arise from a grammar spec without a behavior spec. Python typecheckers predate in-language annotations and drove the spec, not vice versa.
- Kwpolska 4y agoFunction annotations were added as part of Python 3.0, with PEP 3107, proposed in 2006 [0]. The first public mypy commit was in 2012 [1], and originally it was using C++-style syntax (`list<Token> lex(str s):`). The `typing` module and the official use of function annotation for type hints came in 2014 with PEP 484 [2], inspired by mypy. The first pyright commit was in 2019 (with a lot of code in the third commit [3], possibly moved from the VSCode extension). [0] https://peps.python.org/pep-3107/ https://peps.python.org/pep-3107/ [1] https://github.com/python/mypy/commit/6f0826a9c169c4f05bb8938347ac0416f8154d91 https://github.com/python/mypy/commit/6f0826a9c169c4f05bb893... [2] https://peps.python.org/pep-0484/ https://peps.python.org/pep-0484/ [3] https://github.com/microsoft/pyright/commit/1d91744b1f268fd088be86df8f2afb205af7019b https://github.com/microsoft/pyright/commit/1d91744b1f268fd0...
- maleldil 4y agoI agree. I believe the type checker should've been part of the interpreter, or a module like pip. Differences between mypy and pyright drive me crazy. That said, I don't think this a reason not to use type hints. They're still useful (see TFA), even if they're not perfect.