Could you summarize your proposal in a few lines? I've tried to read that email several times now and I still don't follow the proposal. You can leave the reasoning *why* you believe your proposal is better out -- I just want to see what it will look like (how to define a type guard, and how to use it).

On Tue, Feb 16, 2021 at 11:39 AM Joseph Perez <> wrote:
I've proposed PEP 593 `Annotated` too, but in the typing-sig mailing list:
and Guido had the following answer:
> I see PEP 593 as a verbose solution to the problem "how do we use
annotations for static typing and for runtime metadata simultaneously".
Type guards solve a problem that's entirely in the realm of static typing,
so IMO it would be an abuse of Annotated.

(I've also written in the mail about checked cast as an alternative solution to type guard.)

> For the most extensible approach both -> TypeGuard(...)  and
-> Annotated[bool, TypeGuard(...)] could be allowed, which would open the
path for future non-type-annotations, which could be used regardless of whether the code
is type-annotated.
I've proposed a possible implementation in my mail linked above.
Python-Dev mailing list --
To unsubscribe send an email to
Message archived at
Code of Conduct:

--Guido van Rossum (
Pronouns: he/him (why is my pronoun here?)