Working on a new book. Fun stuff. It's going to cover Python 3.9.
I'm adding the type hints material. And that means PEP 585. Which means type hints for generics can use the generic types. We can use list[int] instead of List[int] and avoid from typing import List.
It's all fun.
Until...
Wait... What?
When I run mypy, it doesn't like the PEP 585 changes.
I make sure I'm running Python 3.9.0 everywhere. I make sure I have mypy 0.790. I'm baffled.
Then. I find this.
https://github.com/python/mypy/issues/7907
Ah. It appears that mypy is not completely up-to-speed with Python.
And this makes perfect sense.
What I think it means is that I'll have to tweak all of the examples when mypy also supports PEP 585.
For now, I'm sticking with strict checks and the 0.790 release of mypy.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.