]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
docs: typing.Self, fix typo (GH-94771)
authorMax Zhenzhera <59729293+maxzhenzhera@users.noreply.github.com>
Tue, 12 Jul 2022 17:45:52 +0000 (20:45 +0300)
committerGitHub <noreply@github.com>
Tue, 12 Jul 2022 17:45:52 +0000 (18:45 +0100)
* fix typo - double spelled word 'use'

* change methods names to the infinitive form

Doc/library/typing.rst
Lib/typing.py

index 3980e45ed6832474e23e2caaea265e2c5329d35a..4d422f539ad1845e757c88d4a5a849815dde845d 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 66c26e416bd0ba7d760891c7ef7e74c7c4752a01..43ef07e50cfefce6be549d44c1c7e3fc1a568cd8 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