Skip to content
Prev Previous commit
Next Next commit
PEP 673: Link referred to PEP section directly & classmethod func
  • Loading branch information
CAM-Gerlach committed Aug 19, 2022
commit e13edd036e3a572ab13a1e26966491c34e0f07b1
8 changes: 5 additions & 3 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,12 @@ PEP 673: ``Self`` type

The new :data:`~typing.Self` annotation provides a simple and intuitive
way to annotate methods that return an instance of their class. This
behaves the same as the :data:`~typing.TypeVar`-based approach specified
in :pep:`484` but is more concise and easier to follow.
behaves the same as the :data:`~typing.TypeVar`-based approach
Comment thread
CAM-Gerlach marked this conversation as resolved.
Outdated
:pep:`specified in PEP 484<484#annotating-instance-and-class-methods>`,
Comment thread
CAM-Gerlach marked this conversation as resolved.
Outdated
but is more concise and easier to follow.

Common use cases include alternative constructors provided as classmethods
Common use cases include alternative constructors provided as
:func:`classmethod <classmethod>`\s,
Comment thread
CAM-Gerlach marked this conversation as resolved.
and :meth:`~object.__enter__` methods that return ``self``::

class MyLock:
Expand Down