-
-
Notifications
You must be signed in to change notification settings - Fork 372
Add slots and -> None to __init__ in classes #2723
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
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2723 +/- ##
==========================================
- Coverage 98.90% 98.87% -0.04%
==========================================
Files 113 113
Lines 16685 16605 -80
Branches 3025 3014 -11
==========================================
- Hits 16503 16418 -85
- Misses 125 129 +4
- Partials 57 58 +1
|
|
Slots definitely would be a slight improvement in a lot of cases, but we might need to be careful - they technically are backwards incompatible, since arbitrary attributes can't be added anymore. |
|
IMO we should only add |
yeah |
| @@ -1,5 +1,5 @@ | |||
| # | |||
| # This file is autogenerated by pip-compile with Python 3.8 | |||
| # This file is autogenerated by pip-compile with Python 3.11 | |||
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 could send you my (messy and inofficial) tox.ini if you want
|
What's the case for adding a static |
|
Well the main purpose is that it improves memory usage, since the |
that sounds ... not important enough to bother then imho? |
|
Apologies, I don't think this PR is worth merging. The benefits of slots on most classes don't outweigh the downsides (IMO). We've added them to most of the pertinent classes, too. The (I'm really on the edge about the slots thing, though...) What do you think? Also I'm in no way saying this PR will not get merged, just offering my take! |
|
Personally I always make sure to include slots in all the classes I can, because first off when you use |
|
For The big issue is backwards compatibility - any user assigning custom attributes or using weakrefs is going to be broken by this. You can manually add the |
|
Closing this, adding |
This PR adds slots to classes and missing return None type annotations to
__init__functions in_dtls.py.