Skip to content

Commit

Permalink
pythongh-104874: Document NewType.__supertype__ (python#104875)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored May 24, 2023
1 parent dbcdbf1 commit 41768a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,18 @@ These are not used in annotations. They are building blocks for declaring types.
UserId = NewType('UserId', int)
first_user = UserId(1)

.. attribute:: __module__

The module in which the new type is defined.

.. attribute:: __name__

The name of the new type.

.. attribute:: __supertype__

The type that the new type is based on.

.. versionadded:: 3.5.2

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

0 comments on commit 41768a2

Please sign in to comment.