from typing_extensions import Self, reveal_type
class Function:
def __call__(self, *args, **kwargs) -> Self:
return self
class ArrayLike:
__getitem__ = Function()
x = ArrayLike()[0]
reveal_type(x) # Type of "x" is "ArrayLike"
print(type(x))
but prints: <class '__main__.Function'>, as self is Function. This doesn't feel like intended behavior.
but prints:
<class '__main__.Function'>
, as self isFunction
. This doesn't feel like intended behavior.I'm using
pyright 1.1.389
.