-
-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Avoid hasattr(est, expensive-to-calculate-attribute) #7491
Comments
ping @fukatani in case you're interested. |
OK! I'm interested in this issue, I'll work on it! I think |
It's not. But some things can't be changed that easily! On 26 September 2016 at 22:07, fukatani notifications@github.com wrote:
|
I'm sorry for slowly response. Result is here. |
Next, I extract all attributes which |
So next, we have to check
|
It's worth checking the |
thanks |
I got it. |
Thinking about this issue and going through some of the instances of For instance, |
I'm not sure if there are any substantial instances of this outstanding.
I'd not be worried about hasattr with classes_. Basically, it's an issue
where we have inappropriately designed something as an attribute that
should have been a method...
…On 27 July 2018 at 02:55, Adrin Jalali ***@***.***> wrote:
Thinking about this issue and going through some of the instances of hasattr(...,
'classes_'), I've got a question: is the task to change *all* such
instances of hasattr into getattr regardless of where they are, or should
it be only if we know the attribute is a @Property?
For instance, forest.py has such an instance of a call to hasattr, but
there the classes_ is not a @Property so it's okay and it's cheap.
However, it'll be easier to just change all such calls just in case.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7491 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEz68uKpNKMbvHTofJ5Y14hsxpqGhzDks5uKfR2gaJpZM4KGZHj>
.
|
In that case, I guess there isn't much to do (see #11698) |
Thanks for following this up, @adrinjalali |
#7481 raises the issue that checking the presence of some attributes can be expensive and #7487 fixed this for
feature_importances_
. We should identify what other attributes (particularly underscore-suffixed) are currently being checked withhasattr
in the codebase and identify any that are risky by way of being defined as properties that are or may be expensive to compute.grep hackers welcome.
The text was updated successfully, but these errors were encountered: