Skip to content

Commit

Permalink
PEP 696: Add section on binding rules (python#3427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gobot1234 committed Sep 14, 2023
1 parent 2868fe9 commit 94ac129
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions peps/pep-0696.rst
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,21 @@ Function Defaults
functions as ensuring the ``default`` is returned in every code path
where the ``TypeVarLike`` can go unsolved is too hard to implement.

Binding rules
-------------

``TypeVarLikes`` defaults should be bound by attribute access
(including call and subscript).

.. code-block:: python
class Foo[T = int]:
def meth(self) -> Self:
return self
reveal_type(Foo.meth) # type is (self: Foo[int]) -> Foo[int]
Implementation
--------------

Expand Down

0 comments on commit 94ac129

Please sign in to comment.