consider class
class Grid():
def __init__(self,r,z,t):
self.rgrid = r
self.zgrid = z
self.tgrid = t
self.otherstuff = long_computation(r,t,z)
class Solution(Grid):
def __init__(self,r,g):
self.zones = r
Grid.__init__(self,g.r,g.z,g.t)
g = Grid(my_r,my_z,my_t)
sol = Solution(r,g)
This creates what I want, except the "long_computation" is done twice. What would be a clean way to structure the classes that would work whether I called just Grid, or whether I also did the Solution step?
Thanks, J.