According to the typing documentation, Self in staticmethods and metaclasses is rejected.
from typing import Self, Any
class Base:
@staticmethod
def make() -> Self: # should be rejected
...
@staticmethod
def return_parameter(foo: Self) -> Self: # should be rejected
...
class MyMetaclass(type):
def __new__(cls, *args: Any) -> Self: # should be rejected
return super().__new__(cls, *args)
def __mul__(cls, count: int) -> list[Self]: # should be rejected
return [cls()] * count
class Foo(metaclass=MyMetaclass): ...
https://play.ty.dev/017c6126-8d90-4619-a721-51eeff356725
According to the typing documentation,
Selfin staticmethods and metaclasses is rejected.https://play.ty.dev/017c6126-8d90-4619-a721-51eeff356725