Great! I will start drafting a PEP later. I hopefully will get a draft out later this week to send to typing-sig.

Planned deprecation/removal schedule:


3.11: We missed the beta cutoff but that's ok, it gives us a whole release cycle to start warning people. Type checkers and linters can optionally start emitting warnings of the deprecation. 

3.12: Start emitting DeprecationWarning when the parser hits a type comment other than ignore. This will be emitted in 3.13 as well.

3.14: Emit a SyntaxError for non-type ignore type comments

Let me know if anyone has other suggestions.

Ethan

On Mon, Jun 6, 2022, 8:54 AM Guido van Rossum <guido@python.org> wrote:
I'd just like to pile on that yes, it would be good to start deprecating these now so type checkers that currently support them don't have to feel uncomforming if they decide to drop them. A PEP seems reasonable.

I also agree that for type comments on 'with' and 'for' we should just recommend putting the type annotation before the statement (this is already needed in some cases in match/case statements).

--Guido

On Mon, Jun 6, 2022 at 12:51 AM Martin DeMello via Typing-sig <typing-sig@python.org> wrote:
Tangentially, there is a libcst codemod to convert typecomments to type annotations, so that would be a good thing to point people to when support is dropped. (It would be nice to remove support for them from pytype too; we dropped both host and target python2 support, but so far we have retained typecomment support).

martin

On Sun, Jun 5, 2022 at 1:26 PM Ethan Smith <ethan@ethanhs.me> wrote:
Hi all,

Recently I was thinking about the place of type comments in Python typing. As far as I am aware, mypy is the only typechecker that remains that still supports Python 2. I expect we will remove support for Python 2 before the end of the year (but we haven't decided anything on that yet).

So what does this  mean for type comments? I think it would be best if we no longer needed to support them. However, there are a couple of issues:

1. They are specified in PEP 484 so we would need a new PEP most likely to deprecate/remove them
2. There isn't an obvious replacement for for/with type comments, we'd need to figure out a reasonable replacement.

Anyway, I thought I'd start this thread to kick off some discussion, I'd love to hear what others think and if people have ideas for syntax for with/for statements.

Ethan
He/Him
_______________________________________________
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: mdemello@google.com
_______________________________________________
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)