`typing.NewType` has always had an attribute `__supertype__` pointing to its supertype. It is widely used in the wild (e.g. https://github.com/pydantic/pydantic/blob/00158878cb1c6218cd58ee62248db56c65e4172c/pydantic/_internal/_typing_extra.py#L153, https://github.com/quora/pyanalyze/blob/bd7f520adc2d8b098be657dfa514d1433bea3b0c/pyanalyze/annotations.py#L456), but not documented. Let's document it and commit to leaving it stable. <!-- gh-linked-prs --> ### Linked PRs * gh-104875 * gh-104906 * gh-104907 <!-- /gh-linked-prs -->
Activity
gh-104874: Document NewType.__supertype__ (#104875)
pythongh-104874: Document NewType.__supertype__ (pythonGH-104875)
pythongh-104874: Document NewType.__supertype__ (pythonGH-104875)
[3.12] gh-104874: Document NewType.__supertype__ (GH-104875) (#104906)
[3.11] gh-104874: Document NewType.__supertype__ (GH-104875) (#104907)