On 2/21/21 12:04 AM, Joseph Perez wrote:
Required[T] can evaluate to a box of type Required with parameter T, which the TypedDict __new__ can inspect. It can be implemented in a straightforward fashion.
Again, I think you forget PEP 563; with it, `Required[T]` **will not evaluate** at all. By the way, `ClassVar` and `InitVar` are already boxes like you describe, but `dataclasses` module still has to use regex parsing in case of annotation being stringified.
Look, Python 3.10a is already out, which has presumably has some strategy so that TypedDict (and its metaclass) continue to work at runtime. I’ll hook into whatever strategy that is. We’re don’t need to take up the time of typing-sig with this low level discussion of implementation details. Only comments that potentially affect design details or the overall viability of the PEP are relevant here. -- David Foster | Seattle, WA, USA Contributor to TypedDict support for mypy