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
Currently, values are looked-up in instance dict and then in class MRO. Furthermore, default values are inferred at class creation from the latest class defining it as parameter and are immutable. For example:
# CurrentlyfromparamclassesimportIMPL, MISSING, ParamClassclassA(ParamClass): # Defines "x" as one of its parametersx: intclassB(A): # Does not define "x" as a parameterx=0B.x=1assertgetattr(B, IMPL).default["x"] isMISSING# PassesB() # B(x=1)A.x=2# Doesn't affect defaultassertgetattr(A, IMPL).default["x"] isMISSING# Passesassertgetattr(B, IMPL).default["x"] isMISSING# Passes
Is it ok to bypass classes not defining "x" as a parameter (e.g.B)?
Shouldn't we reflect the A.x = 2 change in defaults? I think we should.
For 2., use a (param, owner) approach, similar to protected attributes.
The text was updated successfully, but these errors were encountered:
Currently, values are looked-up in instance dict and then in class MRO. Furthermore, default values are inferred at class creation from the latest class defining it as parameter and are immutable. For example:
"x"
as a parameter (e.g.B
)?A.x = 2
change in defaults? I think we should.For 2., use a
(param, owner)
approach, similar to protected attributes.The text was updated successfully, but these errors were encountered: