Skip to content

Commit 41768a2

Browse files
gh-104874: Document NewType.__supertype__ (#104875)
1 parent dbcdbf1 commit 41768a2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Doc/library/typing.rst

+12
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,18 @@ These are not used in annotations. They are building blocks for declaring types.
16481648
UserId = NewType('UserId', int)
16491649
first_user = UserId(1)
16501650

1651+
.. attribute:: __module__
1652+
1653+
The module in which the new type is defined.
1654+
1655+
.. attribute:: __name__
1656+
1657+
The name of the new type.
1658+
1659+
.. attribute:: __supertype__
1660+
1661+
The type that the new type is based on.
1662+
16511663
.. versionadded:: 3.5.2
16521664

16531665
.. versionchanged:: 3.10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Document the ``__name__`` and ``__supertype__`` attributes of
2+
:class:`typing.NewType`. Patch by Jelle Zijlstra.

0 commit comments

Comments
 (0)