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
{{ message }}
Repository navigation
Incorrect handling of Self when operating on the different class instance than self #14635
While I'm bummed because I was hoping I could fix the forward declaration problem nearly everywhere by applying Self even to normal methods, your explanation about the type theory reasoning makes sense. I guess we'll keep using from __future__ import annotations until PEP 649 lands.
Activity
JelleZijlstra commentedon Feb 7, 2023
This error is correct.
Selfmeans that the method will return the same type even in subclasses. Your method does not do that.johnthagen commentedon Feb 8, 2023
Thanks for the explanation @JelleZijlstra.
While I'm bummed because I was hoping I could fix the forward declaration problem nearly everywhere by applying
Selfeven to normal methods, your explanation about the type theory reasoning makes sense. I guess we'll keep usingfrom __future__ import annotationsuntil PEP 649 lands.hauntsaninja commentedon Feb 8, 2023
Maybe it could be allowed in final classes