Skip to content

Commit 3b3f2e1

Browse files
[3.11] gh-104874: Document NewType.__supertype__ (GH-104875) (#104907)
gh-104874: Document NewType.__supertype__ (GH-104875) (cherry picked from commit 41768a2) Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent 5e91167 commit 3b3f2e1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Doc/library/typing.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,18 @@ These are not used in annotations. They are building blocks for declaring types.
16281628
UserId = NewType('UserId', int)
16291629
first_user = UserId(1)
16301630

1631+
.. attribute:: __module__
1632+
1633+
The module in which the new type is defined.
1634+
1635+
.. attribute:: __name__
1636+
1637+
The name of the new type.
1638+
1639+
.. attribute:: __supertype__
1640+
1641+
The type that the new type is based on.
1642+
16311643
.. versionadded:: 3.5.2
16321644

16331645
.. versionchanged:: 3.10
Lines changed: 2 additions & 0 deletions
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)