I've proposed PEP 593 `Annotated` too, but in the typing-sig mailing list: https://email@example.com/message/CVLLRWU7MU7T2AMC4P7ZEG4IMJF6V5UL/
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
I've proposed a possible implementation in my mail linked above.
Python-Dev mailing list -- firstname.lastname@example.org
To unsubscribe send an email to email@example.com
Message archived at https://firstname.lastname@example.org/message/B3QZTPW6S6LHQKX476VRYAWEVMZ26VHH/
Code of Conduct: http://python.org/psf/codeofconduct/