Re: PEP 655: Marking individual TypedDict items as required or potentially-missing
March 2, 2021
4:30 a.m.
On 3/1/21 8:22 PM, Paul Bryan wrote:
Can you confirm the following statements /would/ be valid? (i.e. TypedDict can still be dynamically constructed, now with Required and NotRequired...)
TD1 = TypedDict("TD1", {"a": Required[str]}, total=False)
TD2 = TypedDict("TD2", b=NotRequired[int])
I think these *should* be valid, although the PEP doesn't currently say anything about the non-class syntax for TypedDict. I'll plan to add a sentence or two to the PEP about this form. -- David Foster | Seattle, WA, USA Contributor to TypedDict support for mypy
1868
Age (days ago)
1868
Last active (days ago)
0 comments
1 participants
participants (1)
-
David Foster