-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add concrete keyword to descendents #1027
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1027 +/- ##
==========================================
- Coverage 87.27% 87.26% -0.02%
==========================================
Files 9 9
Lines 4936 4939 +3
==========================================
+ Hits 4308 4310 +2
- Misses 628 629 +1 ☔ View full report in Codecov by Sentry. |
The concept here makes sense to me. Discussing this with Maxime, we decided there are two paths we can take:
These things are orthogonal and I think the first suggestion is a good idea regardless. I do see the argument for deprecating This PR is necessary whether we decide to deprecate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@@ -518,26 +518,52 @@ def _is_number(obj): | |||
else: return False | |||
|
|||
|
|||
def _is_abstract(class_): | |||
def _is_abstract(class_: type) -> bool: | |||
if inspect.isabstract(class_): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I haven't looked where this is used; if it is not in many places, ignore me).
Is there a penalty related to this check? E.g. if this is in a hotpath will this add significant overhead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timed it and it's 2-3x slower than the try/except that follows. That's also not a particularly hot path I think.
Somewhat related to #651, the idea being to steer users towards
descendents
instead ofconcrete_descendents
(to deprecate it ultimately but it'll take a little while as it's used in a lot of holoviz code bases).