2 Mar
2021
2 Mar
'21
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