Mailing List Archive

bpo-44353: Correct docstring for `NewType` (GH-29785)
https://github.com/python/cpython/commit/3f024e27c29a57dd4f805aa2431d713ed0fe57b2
commit: 3f024e27c29a57dd4f805aa2431d713ed0fe57b2
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
committer: miss-islington <31488909+miss-islington@users.noreply.github.com>
date: 2021-11-26T06:58:13-08:00
summary:

bpo-44353: Correct docstring for `NewType` (GH-29785)


The docstring for `typing.NewType` is no longer strictly accurate, now that `NewType` is a class, rather than a function
(cherry picked from commit 93c65df83cef71a4bc77d71afecdec8744c4f73a)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

files:
M Lib/typing.py

diff --git a/Lib/typing.py b/Lib/typing.py
index 21caabb5d3e67..b743d400c0e5f 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -2427,7 +2427,7 @@ class NewType:
"""NewType creates simple unique types with almost zero
runtime overhead. NewType(name, tp) is considered a subtype of tp
by static type checkers. At runtime, NewType(name, tp) returns
- a dummy function that simply returns its argument. Usage::
+ a dummy callable that simply returns its argument. Usage::

UserId = NewType('UserId', int)


_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins