Skip to content

Commit 726b448

Browse files
committed
Add reference to descriptor guide find_name_in_mro
1 parent 1a7e9df commit 726b448

File tree

1 file changed

+5
-2
lines changed
  • crates/red_knot_python_semantic/resources/mdtest/call

1 file changed

+5
-2
lines changed

crates/red_knot_python_semantic/resources/mdtest/call/dunder.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ as the `instance` argument to `__get__`. A desugared version of `obj[key]` is ro
1616
```py
1717
from typing import Any
1818

19-
def find_in_mro(typ: type, name: str) -> Any: ...
19+
def find_name_in_mro(typ: type, name: str) -> Any:
20+
# See implementation in https://docs.python.org/3/howto/descriptor.html#invocation-from-an-instance
21+
pass
22+
2023
def getitem_desugared(obj: object, key: object) -> object:
21-
getitem_callable = find_in_mro(type(obj), "__getitem__")
24+
getitem_callable = find_name_in_mro(type(obj), "__getitem__")
2225
if hasattr(getitem_callable, "__get__"):
2326
getitem_callable = getitem_callable.__get__(obj, type(obj))
2427

0 commit comments

Comments
 (0)