Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Update the behaviour of the `type` function for metaclasses #2826
Can you give a concrete example?
class M(Generic(T), Type[T]): pass # maybe M(type) is a shorthand for this T1 = TypeVar('T1', bound='A') class A(metaclass=M): @classmethod def foo(cls: M[T1]) -> T1: return cls() reveal_type(A) # E: Revealed type is M[A] class B(A): pass reveal_type(B) # E: Revealed type is M[B] reveal_type(B.foo()) # E: Revealed type is B
All of this should be how things work right now, except that