You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I saw the Pycon 2016 talk from Nina Zakharenko about Memory Management in Python and at the 21:19 min, she introduced the dunker slots attribute to define the attributes. Because with that, you can't assign at runtime new attributes to the class instance. This reduces the memory usage and improves performance.
You mean to use this in the handler-classes? Thanks, I didn't know that before! Also, I never used ``@dataclass()` (with or without slots) in my code. Thanks for that!
However, I have to admit that TrussPy was my first open-source coding project. There could be lots of anti-pattern and non-pythonic code inside. Due to its (over) complexity, I was careful in the past not to break anything because the performance is okay for these typically small systems, the results are fine and it is easy to use.
I'll leave this open - if I find some time, I'll give it a try.
I've only recently picked up on this as well. I'm not sure whether there will be an increase in performance in this case. It is beneficial when thousands of instances of a class are created. I am unsure if this is the case here.
I saw the Pycon 2016 talk from Nina Zakharenko about Memory Management in Python and at the 21:19 min, she introduced the dunker slots attribute to define the attributes. Because with that, you can't assign at runtime new attributes to the class instance. This reduces the memory usage and improves performance.
To reduce boilerplate, there is also the possibility to use
@dataclass(slots=True)
as shown in this video, see also the python documentation → https://docs.python.org/3.10/library/dataclasses.htmlThe text was updated successfully, but these errors were encountered: