When a method returns the argument `self`, use `typing.Self` to annotate the return type of the method: ```py from typing import Self class P: def some_method(self) -> Self: ... return self ``` Why is this useful?
1 likes 1 replies
?
When a method returns the argument `self`, use `typing.Self` to annotate the return type of the method: ```py from typing import Self class P: def some_method(self) -> Self: ... return self ``` Why is this useful?
1 likes 1 replies