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 <jope...@hotmail.fr> wrote:

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


-- 
--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-change-the-world/>
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/RL7KWEW6OKWW7TLZAX4AE76EJHG5LAWD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to