-
Notifications
You must be signed in to change notification settings - Fork 3
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
Options class replacement #27
Comments
I agree with the points above. In general I think the idea of a persistent / immutable data structure for options is a good one, but options is probably too flexible: It provides too many different ways to update or modify values (mutating or non-mutating? |
For modifying nested data structures (e.g. maps containing maps), the JS immer library has a quite nice interface: https://immerjs.github.io/immer/docs/introduction. I don't know how hard that might be to implement in python though, especially with the limitations of python lambdas. Things are simpler if options is a flat dict/map structure, so options can't contain options. |
It might actually be nice to have the options be immutable by default, but be able to say that some are allowed to be changed. I think mostly the options have to be set when the Edit: it might be better to have two different options objects in |
(not really the ideal place for this, but want to keep it in an open issue somewhere)
|
obviously with comments, tests. This allows it to be treated as a dictionary (or Bunch, with the getattr method), except that changes don't propagate upstream. For example:
Where there are default values that the user is overriding, this would be used as:
|
As discussed here #25 (comment) there are various issues with using the
options
module for handling settings inhypnotoad
:@dschwoerer
options
allows getting options simply as e.g.self.options.orthogonal
, but "that is only a few lines [to implement], I [@dschwoerer] did that to drop the dependency on Bunch."@ZedThree
deepcopy
A replacement
Options
class would be welcome. Maybe a possibility for something shared withxBOUT
boutproject/xBOUT#94 boutproject/xBOUT#97?The text was updated successfully, but these errors were encountered: