[Python-checkins] bpo-40257: Tweak docstrings for special generic aliases. (GH-20022)

Serhiy Storchaka webhook-mailer at python.org
Sun May 10 08:14:39 EDT 2020


https://github.com/python/cpython/commit/2fbc57af851814df567fb51054cb6f6a399f814a
commit: 2fbc57af851814df567fb51054cb6f6a399f814a
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-05-10T15:14:27+03:00
summary:

bpo-40257: Tweak docstrings for special generic aliases. (GH-20022)

* Add the terminating period.
* Omit module name for builtin types.

files:
M Lib/typing.py

diff --git a/Lib/typing.py b/Lib/typing.py
index b5ba38e07c835..f94996daebd6e 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -753,7 +753,10 @@ def __init__(self, origin, nparams, *, inst=True, name=None):
             name = origin.__name__
         super().__init__(origin, inst=inst, name=name)
         self._nparams = nparams
-        self.__doc__ = f'A generic version of {origin.__module__}.{origin.__qualname__}'
+        if origin.__module__ == 'builtins':
+            self.__doc__ = f'A generic version of {origin.__qualname__}.'
+        else:
+            self.__doc__ = f'A generic version of {origin.__module__}.{origin.__qualname__}.'
 
     @_tp_cache
     def __getitem__(self, params):



More information about the Python-checkins mailing list