* fix typo - double spelled word 'use'
* change methods names to the infinitive form
from typing import Self
class Foo:
- def returns_self(self) -> Self:
+ def return_self(self) -> Self:
...
return self
Self = TypeVar("Self", bound="Foo")
class Foo:
- def returns_self(self: Self) -> Self:
+ def return_self(self: Self) -> Self:
...
return self
...
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:
from typing import Self
class Foo:
- def returns_self(self) -> Self:
+ def return_self(self) -> Self:
...
return self