[Python-Dev] PEP 589 discussion (TypedDict) happening at typing-sig@
Thanks for submitting this PEP, I think it will be a net plus for the
python language. I have been using TypedDict as a mypy_extensions module
and it's been a great help.
I found that the one thing that may be less intuitive and its design is the
totality property. The fact that you need to use inheritance to compose
TypedDicts that contain both required and optional keys create situations
that may be a little verbose for some use cases. Perhaps an "optional"
property taking a list of keys that type checkers would recognize as (no
surprise) optional could be an alternative design with some merit.
On Mon, Apr 15, 2019 at 12:44 PM Jukka Lehtosalo <jlehtosalo at gmail.com>
> Hi everyone,
> I submitted PEP 589 (TypedDict: Type Hints for Dictionaries with a Fixed
> Set of Keys) for discussion to typing-sig .
> Here's an excerpt from the abstract of the PEP:
> PEP 484 defines the type Dict[K, V] for uniform dictionaries, where each
> value has the same type, and arbitrary key values are supported. It doesn't
> properly support the common pattern where the type of a dictionary value
> depends on the string value of the key. This PEP proposes a type
> constructor typing.TypedDict to support the use case where a dictionary
> object has a specific set of string keys, each with a value of a specific
> Jukka Lehtosalo
>  https://mail.python.org/mailman3/lists/typing-sig.python.org/
> Python-Dev mailing list
> Python-Dev at python.org
-------------- next part --------------
An HTML attachment was scrubbed...