Proposal: Move __call__
in Zgr
and make compute_z3
an abstract method
#45
Labels
design
Design discussion
__call__
in Zgr
and make compute_z3
an abstract method
#45
I'm having second thoughts about how we are using
__init__
and__call__
in thezgr
child classes.The parent
Zgr
knows aboutjpk
, but it doesn't do any computationally expensive stuff when it is initialized.I.e., I don't think there's any advantage in initializing the class only once. I also think it is easier to do:
rather than
I suggest we move
__call__
inZgr
, where call does not have any argument and returns the final object with all z3 and e3.The parent
__init__
can stay as it is:__init__(obj, jpk)
.Childs'
__init__
would just add arguments to the parent__init__
.Finally,
compute_z3
should be an abstract method in the parent class (Zgr
), and that abstract method should be used by the parent class to generatez3
needed to computee3
.Recap:
Zco(obj, jpk, ...)
. Child classes initialize additional arguments and their__init__
end withsuper().__init__(obj, jpk)
z3
. How they do it, it's notZgr
business.ds_out = Zco(ds_in, jpk, **kwargs)()
ds_out = ds_in.domcfg.zco(jpk, **kwargs)
The text was updated successfully, but these errors were encountered: