Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting default values unused #2

Open
jannikmi opened this issue Sep 3, 2020 · 1 comment
Open

setting default values unused #2

jannikmi opened this issue Sep 3, 2020 · 1 comment

Comments

@jannikmi
Copy link

jannikmi commented Sep 3, 2020

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

@rfloca
Copy link
Contributor

rfloca commented Sep 3, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants