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

Overriding __setattr__ to avoid having to explicitly call mean_subtract #36

Open
mwilensky768 opened this issue Nov 12, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@mwilensky768
Copy link
Owner

Currently the user must explicitly call ins.mean_subtract (AND explicitly make an assignment to ins.metric_ms). Since the metric_ms attribute is always given by the line ins.metric_ms = ins.mean_subtract(), this line is basically superfluous in many applications. This could be circumvented by overriding setattr() and adding an if clause to check if the metric_array is being changed. To fully generalize this, we may have to override numpy.ndarray.setitem

@mwilensky768 mwilensky768 added the enhancement New feature or request label Nov 12, 2019
@mwilensky768
Copy link
Owner Author

mwilensky768 commented Jul 22, 2020

This might be a better way to do linked attributes. Performance may suffer if having to recalculate the metric_ms many extra times. Will want to program around this.

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

No branches or pull requests

1 participant