-
Notifications
You must be signed in to change notification settings - Fork 315
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
Overwriting parameters in inherited instruments #32
Comments
Three options come to mind:
def __init__(self, ...):
# first add the overridden parameters
self.add_parameter('override1', ...)
self.add_parameter('override2', ...)
...
# tell add_parameter() to not raise on overrides, just return without adding
self.ignore_override_errors = True
super().__init__(...)
# turn off this behavior afterward
self.ignore_override_errors = False we could even get fancy and make this a context manager so you can't forget to clean up: with self.ignore_override_errors:
super().__init__(...) |
@alexcjohnson |
@AdriaanRol can you provide some examples where you would want to do this ? |
@giulioungaretti you could have a base |
@MerlinSmiles fair point ! |
So the proposed solution is to have an explicit overwrite_parameter function. |
@giulioungaretti would it break anything to be able to overwrite existing ones by default? |
I would propose as an argument in add_parameter, not a special function. |
I think it make more sense be explicit and avoid confusion. In this way you
|
@AdriaanRol not sure what you mean with traces. |
@AdriaanRol how about implementing as you proposed an add_praemter(...., overwrite=False) ? |
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
Make do1d flush the buffers of the involved instruments. This is to avoid instruments getting out of sync with their messages and consequently delivering garbage data.
This is now possible via #3125 |
Currently parameters are added to an instrument in the init. Once a parameter is added it is not possible to overwrite this by using another add_parameter command. When inheriting an instrument you generally want to overwrite inherited functions as well as some parameters. This is currently not possible.
The current workaround would be to overwrite the entire init and copy paste all the add_parameter commands that were in the parent class. I think it makes sens to run super().init(...) and then only overwrite those parameters that are overwritten.
The text was updated successfully, but these errors were encountered: