Skip to content

Commit 94ac129

Browse files
authored
PEP 696: Add section on binding rules (#3427)
1 parent 2868fe9 commit 94ac129

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

peps/pep-0696.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,21 @@ Function Defaults
382382
functions as ensuring the ``default`` is returned in every code path
383383
where the ``TypeVarLike`` can go unsolved is too hard to implement.
384384

385+
Binding rules
386+
-------------
387+
388+
``TypeVarLikes`` defaults should be bound by attribute access
389+
(including call and subscript).
390+
391+
.. code-block:: python
392+
393+
class Foo[T = int]:
394+
def meth(self) -> Self:
395+
return self
396+
397+
reveal_type(Foo.meth) # type is (self: Foo[int]) -> Foo[int]
398+
399+
385400
Implementation
386401
--------------
387402

0 commit comments

Comments
 (0)