-
-
Notifications
You must be signed in to change notification settings - Fork 576
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
Remove param = self.param
and use self.param
directly instead
#4484
Comments
I think @kratman also had some concerns about the performance of doing |
Using We could switch to using |
For clarification what I was saying is that the benefits of a local reference (param) to the member (self.param) are
But the costs are
I think it is better to use the member variable because being clear about which one is used is better for developers. In the background they both point to the same memory location since they are not copies but references. So I would expect time differences to be tiny if they exist at all. |
With the comments above, a good compromise could be to keep the |
I would say that any memory benefits are minimal compared to the benefits of clarity. So using Trying to squeeze out performance by controlling access to member variables is basically the definition of pre-mature optimization. I would be more concerned with people not realizing that |
Fair point! For clarity, I meant Basic Models (not Base Model) so these are the models where everything is defined in a single script (as opposed to across files, like with the submodels). |
Originally posted by @kratman in #4451 (comment)
There are 63 occurrences of
param = self.param
so I thought this would be better as separate issue.The text was updated successfully, but these errors were encountered: