On 30/01/2022 05:15, David Foster wrote:
This PEP [1] introduces syntax to mark individual keys of a TypedDict
as either required or potentially-missing. Previously the only way to
have a TypedDict with mixed required and non-required keys was to
define two TypedDicts - one with total=True and one with total=False -
and have one of those TypedDicts inherit from the other. This PEP
introduces special forms Required[] and NotRequired[] to the "typing"
module that can be used to directly mark individual items of a
TypedDict as required or not-required. We have implementations for
mypy, pyright, and pyanalyze.
Consensus on the PEP has been reached in typing-sig.
My understanding of the PEP process as described in PEP 1 [2] is that
content review should be requested of core developers here in
python-dev. So consider this my official request for comments! ^_^
I believe that after review & feedback from python-dev the next step
would be to submit this PEP to the Steering Council. However it's not
clear to me from [2] where I should actually do that when the time comes.
I think the names `Required` and `NotRequired` are too generic for
something which can only be used in one context (`TypedDict`s), and it
is not immediately obvious when reading code without context what the
difference between `NotRequired` and `Optional` might be. Could they be
put into a pseudo-module like `typing.io`, e.g. `TypedDict.Required`?
_______________________________________________
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/HSVVKLSFJAAONQXRFDZ4UUHRYKBM6GTU/
Code of Conduct: http://python.org/psf/codeofconduct/