[Python-checkins] bpo-44353: Correct docstring for `NewType` (#29785)

gvanrossum webhook-mailer at python.org
Thu Nov 25 23:55:24 EST 2021

commit: 93c65df83cef71a4bc77d71afecdec8744c4f73a
branch: main
author: Alex Waygood <Alex.Waygood at Gmail.com>
committer: gvanrossum <gvanrossum at gmail.com>
date: 2021-11-25T20:55:15-08:00

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

The docstring for `typing.NewType` is no longer strictly accurate, now that `NewType` is a class, rather than a function

M Lib/typing.py

diff --git a/Lib/typing.py b/Lib/typing.py
index 031aa24eaf442..bdd19cadb471a 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)

More information about the Python-checkins mailing list