language/environment: only call prepare automatically if it exists

This commit is contained in:
Sebastien Bourdeauducq 2016-09-09 09:06:59 +08:00
parent 7efd990541
commit 6aaf6c8789
1 changed files with 3 additions and 2 deletions

View File

@ -380,9 +380,10 @@ class EnvExperiment(Experiment, HasEnvironment):
Most experiment should derive from this class.""" Most experiment should derive from this class."""
def prepare(self): def prepare(self):
"""The default prepare method calls prepare for all children, in the """The default prepare method calls prepare for all children, in the
order of instantiation.""" order of instantiation, if the child has a prepare method."""
for child in self.children: for child in self.children:
child.prepare() if hasattr(child, "prepare"):
child.prepare()
def is_experiment(o): def is_experiment(o):