On 3/2/21 1:17 PM, Eric Traut wrote:
David, the PEP is looking good.
I just published a version of pyright (1.1.117) that has support for the latest draft of the PEP. It was pretty straightforward to implement. Here's a [link to the change](https://github.com/microsoft/pyright/commit/7ed245b1845173090c6404e49912e8cb...) in case maintainers of other type checkers would like to take a look at the test cases or implementation details.
I'm hoping to get started on the mypy implementation later this weekend, after integrating the previous week's feedback into the PEP draft.
There were a few questions that I ran across in the implementation that were not answered in the latest draft of the PEP.
- How do `Required` and `NotRequired` interact with `Annotated` (PEP 593)? I assume that an `Annotated` can be contained within a `Required` or `NotRequired`, but the converse is not true.
Agreed. That makes sense to me.
- Are `Required` and `NotRequired` supported only in the class form of a TypedDict? Or are they supported in the alternative syntax? For now, I have implemented it such that any use of `Required` and `NotRequired` outside of a TypedDict class definition is considered an error, so it is not allowed in the alternative syntax.
I'm leaning toward allowing Required and NotRequired in the alternative syntax  since it already supports specifying totality.