You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classA(Generic[T]):
x=NoneA[int].x=1A[str].x='a'print(A[int].x) # prints 1print(A[int]().x) # prints None, since type is erased on instantiation
@JukkaL argues and I agree with him, that this looks wrong. Conceptually, there should be only one runtime class. I think we can implement this without loosing the current runtime generic information by tweaking descriptor __dict__ of GenericMeta, so that all assignments and look-ups on subscripted class objects like A[int] will be transferred to the original class object A.