We'd like to be able to use typing.Self to annotate return types of method Operations. From the typing standard library documentation and the official typing specification, Self is equivalent to a type variable in the following sense, so it should be straightforward to fold into our existing machinery for handling type variables in internals.unification:
class Foo:
def return_self[Self: "Foo"](self: Self) -> Self:
...
return self
We'd like to be able to use
typing.Selfto annotate return types of methodOperations. From thetypingstandard library documentation and the officialtypingspecification,Selfis equivalent to a type variable in the following sense, so it should be straightforward to fold into our existing machinery for handling type variables ininternals.unification: