Thanks for the feedback Petr,

- if this PEP really only affects typing.py and external
projects/tools, it should say so clearly (so e.g. a parser experts can
skip reading the PEP with clear conscience, even though it "introduces
two new syntaxes")

Did propose a new paragraph in the Abstract section that should make this clear:

"No Python grammar changes are made by this PEP. Correct usage
of required and potentially-missing keys of TypedDicts is intended to be
enforced only by static type checkers and in particular is not enforced by
Python itself at runtime."

- in Specification, clarify what "It is an error" means -- is it a
Python runtime error, or an error type checkers should raise? Same for
"It is valid".

It is a *logical* error. To be explicit:

(1) It's definitely an error that type checkers MUST raise.

(2) The runtime implementations of Required[] and NotRequired[] MAY also choose to raise errors at runtime on a best effort basis.

In particular the prohibition on nesting Required[] and NotRequired[] inside each other is likely to be enforced at runtime by the __getitem__ functions on the type form implementations, because it is easy to do so.


All of the preceding clarifications have been proposed in a PR:
https://github.com/python/peps/pull/2388


Best,
--
David Foster | Seattle, WA, USA
Contributor to Python's type system
_______________________________________________
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/3TWAKPPEORI2VPEAVNCC4GIOR22TAILQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to