Usage of __slots__ #1249
Unanswered
krahabb
asked this question in
Entity Models
Replies: 1 comment
-
I went through the codebase over a year (?) ago and put slots on all dataclasses I could do in core. Trying to do it through the rest of the codebase would've been a nightmare because each integration's maintainer would have to sign off on it. But, I do agree, slots should be used more and perhaps even be part of the approval process for PRs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I see most of the HA codebase doesn't implement slots. While some classes have received some care over the years, it is my impression that usage of
slots
is not enforced nor 'regulated' by any policy (unless I've missed that).Is there an 'official position' about this topic ?
Also, many dataclasses are defined without slots (even though many are defined with...) so, even for this type of classes it appears to me that there's no 'clear' direction.
I see that implementing slots may have it's subtleties but, at least for what are the 'final' core classes this could be enforced so that the even those minimum benefits of memory footprint and access performance could be reached.
In the end, being HA a very 'resource intensive' software, it could gain another little bit of performance by taking care of this.
Beta Was this translation helpful? Give feedback.
All reactions