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:
def__init___(self, x, y):
# some value computed from the parametersself.n=x**2+yclassB:
def__init___(self, n):
self.n=n
I would like to be able to do this in my config:
A.x=3A.y=2B.n= @A().n
Hard-coding B.n = 11 would be bad because we might forget to change it when we update A.x. Obviously one can just not use the config for this and create a = A() first in Python then b = B(a.n). If the instances of A and B wouldn't naturally be created in the same place, though, then this makes the code worse since we have to pass a (or at least a.n) around.
The text was updated successfully, but these errors were encountered:
Say we have a setup like this
I would like to be able to do this in my config:
Hard-coding
B.n = 11
would be bad because we might forget to change it when we updateA.x
. Obviously one can just not use the config for this and createa = A()
first in Python thenb = B(a.n)
. If the instances ofA
andB
wouldn't naturally be created in the same place, though, then this makes the code worse since we have to passa
(or at leasta.n
) around.The text was updated successfully, but these errors were encountered: