Closed pgkirsch closed 8 years ago
You could have another private method or attribute with the common substitutions?
_subs = {...}
@classmethod
def standalone_737(cls):
substitutions = {...}
substitutions.update(self._subs)
I could but this doesn't capture the "intent" where the standalone
subs dict has the maximum number of substitutions needed for a model to work, and that the coupled
(or aircraft
) version just allows using fewer of these substitutions. I'm leaning towards something like pop
or del
. @whoburg suggested creating a third @classmethod
that just returns the standalone substitutions dict and both standalone
and coupled
call this method, and the latter modifies the dictionary as necessary.
Sounds good!
Seems like a decent consensus then - closing for now
The current module structure for something like the vertical tail model is:
This involves a lot of duplication in the substitutions dict. Notionally, what I would like is for the
aircraft_737
to "inherit" (for want of more correct terminology) from thestandalone_737
class method and just punch out a few of the entries in the dict.Any suggestions for an elegant pythonic way of doing this @bqpd @whoburg? Ideally the proposed fix would involve changing as little code as possible.