mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
[3.11] gh-104874: Document NewType.__supertype__ (GH-104875) (#104907)
gh-104874: Document NewType.__supertype__ (GH-104875)
(cherry picked from commit 41768a2bd3
)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
5e911673e4
commit
3b3f2e107b
2 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Document the ``__name__`` and ``__supertype__`` attributes of
|
||||
:class:`typing.NewType`. Patch by Jelle Zijlstra.
|
Loading…
Add table
Add a link
Reference in a new issue