[Python-checkins] docs: typing.Self, fix typo (GH-94771)
miss-islington
webhook-mailer at python.org
Tue Jul 12 14:17:18 EDT 2022
https://github.com/python/cpython/commit/7c185017a9b68c851ea079ef31f6bcef694378ac
commit: 7c185017a9b68c851ea079ef31f6bcef694378ac
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-07-12T11:17:06-07:00
summary:
docs: typing.Self, fix typo (GH-94771)
* 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 at users.noreply.github.com>
files:
M Doc/library/typing.rst
M Lib/typing.py
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index fceb43aec9be3..ba73d69e87940 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -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:
diff --git a/Lib/typing.py b/Lib/typing.py
index 31269273a5c0d..9d6babefe6c2d 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -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
More information about the Python-checkins
mailing list