-
Notifications
You must be signed in to change notification settings - Fork 6
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
Use __slots__ for frequently created classes #153
Conversation
""" | ||
Passed between uploading stages. | ||
""" | ||
|
||
__slots__ = "data", "upload_id" |
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.
Let's add comment that @dataclasses
support slots=True
in python >= 3.10
repr_ = [f"{attr}: {getattr(self, attr)}" for attr in self.__slots__] # type: ignore | ||
return f"{type(self).__name__}({repr_})" | ||
|
||
def __eq__(self, other): |
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.
Let's add if not isinstance(other, self.__class__): return False
for strictness
Moved fix for codespell errors to dedicated PR - #156 |
No description provided.