]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
docs: typing.Self, fix typo (GH-94771)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 12 Jul 2022 18:17:06 +0000 (11:17 -0700)
committerGitHub <noreply@github.com>
Tue, 12 Jul 2022 18:17:06 +0000 (11:17 -0700)
* fix typo - double spelled word 'use'

* change methods names to the infinitive form
(cherry picked from commit 90a6e56e5663233fe986331ef3f10422fe57dcbc)

Co-authored-by: Max Zhenzhera <59729293+maxzhenzhera@users.noreply.github.com>
Doc/library/typing.rst
Lib/typing.py

index fceb43aec9be378cdca06b487c110747cc94f4c2..ba73d69e87940371113de21d561d5fbafd037565 100644 (file)
@@ -683,7 +683,7 @@ These can be used as types in annotations and do not support ``[]``.
       from typing import Self
 
       class Foo:
-         def returns_self(self) -> Self:
+         def return_self(self) -> Self:
             ...
             return self
 
@@ -696,7 +696,7 @@ These can be used as types in annotations and do not support ``[]``.
       Self = TypeVar("Self", bound="Foo")
 
       class Foo:
-         def returns_self(self: Self) -> Self:
+         def return_self(self: Self) -> Self:
             ...
             return self
 
@@ -707,7 +707,7 @@ These can be used as types in annotations and do not support ``[]``.
             ...
             return self
 
-   You should use use :data:`Self` as calls to ``SubclassOfFoo.returns_self`` would have
+   You should use :data:`Self` as calls to ``SubclassOfFoo.return_self`` would have
    ``Foo`` as the return type and not ``SubclassOfFoo``.
 
    Other common use cases include:
index 31269273a5c0d324c0fc07a9deb3d1ebd7df0c96..9d6babefe6c2d28c3555b18583e890c96a94ce5b 100644 (file)
@@ -569,7 +569,7 @@ def Self(self, parameters):
       from typing import Self
 
       class Foo:
-          def returns_self(self) -> Self:
+          def return_self(self) -> Self:
               ...
               return self