Hyppopy
Hyppopy copied to clipboard
setting default values unused
when I define a new setting of a HyppopySolver
child class with a default value, e.g.
self._add_member(name='test, dtype=bool, default=True)
in define_interface()
. The default value is not being used. I still need to pass it in the project dictionary. Otherwise I get:
File "script.py", line 35, in __init__
super(ChildSolver, self).__init__(project)
File "/hyppopy/solvers/HyppopySolver.py", line 90, in __init__
self.project = project
File "/hyppopy/solvers/HyppopySolver.py", line 404, in project
self._check_project()
File "/hyppopy/solvers/HyppopySolver.py", line 201, in _check_project
raise LookupError(msg)
LookupError: missing settings field test!
It would indeed be nice if even None
default values could be passed to the solver if this has been explicitly declared with default=None
. So if one would be able to make a distinction between "no default value specified" (-> setting must be specified) and default value is None (setting must not be specified). This is especially useful since one does not seem to be able to subscript the default value. So for more complex default values one could easily check for None
and replace the attribute afterwards.
Thanks for this useful package.
version:
hyppopy=0.5.0.8
Hi, thanks for this proposal. I think it is a great idea and a valuable improvement!
We will see how can fit it in our roadmap. Currently we are bussy with the mpi support and other project (deadlines) that bind our attention sigh.
So if you cannot wait, a pull request is also always welcome 😉 .
And thank you for the positive feedback. Glad that it also helps others.