Skip to content

setting default values unused #2

@jannikmi

Description

@jannikmi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions