8000 docs: typing.Self, fix typo (GH-94771) · python/cpython@90a6e56 · GitHub
[go: up one dir, main page]

Skip to content

Commit 90a6e56

Browse files
authored
docs: typing.Self, fix typo (GH-94771)
* fix typo - double spelled word 'use' * change methods names to the infinitive form
1 parent 0c66074 commit 90a6e56

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Doc/library/typing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ These can be used as types in annotations and do not support ``[]``.
683683
from typing import Self
684684

685685
class Foo:
686-
def returns_self(self) -> Self:
686+
def return_self(self) -> Self:
687687
...
688688
return self
689689

@@ -696,7 +696,7 @@ These can be used as types in annotations and do not support ``[]``.
696696
Self = TypeVar("Self", bound="Foo")
697697

698698
class Foo:
699-
def returns_self(self: Self) -> Self:
699+
def return_self(self: Self) -> Self:
700700
...
701701
return self
702702

@@ -707,7 +707,7 @@ These can be used as types in annotations and do not support ``[]``.
707707
...
708708
return self
709709

710-
You should use use :data:`Self` as calls to ``SubclassOfFoo.returns_self`` would have
710+
You should use :data:`Self` as calls to ``SubclassOfFoo.return_self`` would have
711711
``Foo`` as the return type and not ``SubclassOfFoo``.
712712

713713
Other common use cases include:

Lib/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def Self(self, parameters):
569569
from typing import Self
570570
571571
class Foo:
572-
def returns_self(self) -> Self:
572+
def return_self(self) -> Self:
573573
...
574574
return self
575575

0 commit comments

Comments
 (0)
0