8000 [3.11] gh-104874: Document NewType.__supertype__ (GH-104875) by miss-islington · Pull Request #104907 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.11] gh-104874: Document NewType.__supertype__ (GH-104875) #104907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-104874: Document NewType.__supertype__ (GH-104875)
(cherry picked from commit 41768a2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
  • Loading branch information
JelleZijlstra authored and miss-islington committed May 24, 2023
commit fa0088219bc69d8bd3030fee47d7e0ddb88e9c0c
12 changes: 12 additions & 0 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,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