Oh also, I've started drafting a PEP while on a plane ride, I hope to send
a draft tomorrow.
I'll hold off for now until we decide what to do about ignore syntax.
On Wed, Jun 8, 2022, 1:46 PM Ethan Smith
I think it would be best for Python not to define semantics around what comes after # type: ignore, it would be rather limiting.
Instead, I suggest that in the PEP we give the *suggestion* of # type: ignore[type checker, checker specific extra] but that can be figured out among the type checkers.
So for example mypy users can do # type: ignore[mypy,errorcode]
Anyway, I also am worried we've now opened ourselves up to bikeshedding :)
On Wed, Jun 8, 2022, 11:24 AM Guido van Rossum
wrote: I am fine with asking mypy to change its syntax and aiming to design a new syntax for `# type: ignore[...]` comments that all type checkers can use.
I just thought it was odd that the mypy issue you linked to didn't even acknowledge that it is already supported by mypy, so it seemed as if the OP there wasn't aware of that.
On Wed, Jun 8, 2022 at 2:08 PM Eric Traut
wrote: Yes, mypy supports "# type: ignore[x, y, z]", but that's a problem for code bases that are using multiple type checkers.
PEP 484 documents "# type: ignore", but it says nothing about what comes after the comment. Mypy chose to support a non-standard extension where it modifies the behavior of "# type: ignore" if it is followed by a group of mypy-specific diagnostic names enclosed in square brackets. Other type checkers like pyright treat "# type: ignore" as it is documented in PEP 484 regardless of what comes after it.
Developers who want to run both mypy and other type checkers on their code need a way to specify "mypy should ignore these issues", "pyright should ignore these issues", etc. Mypy currently provides no way to do this. Pyright provides a pyright-specific "# pyright: ignore[x, y, z]". It would be good for mypy and other type checkers to do the same. But supporting this is difficult for mypy because it relies on the Python parser, which has intimate knowledge of "# type: ignore" comments.
-Eric _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: guido@python.org
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c... _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: ethan@ethanhs.me