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
Using __slots__ #242
Comments
I'm not familiar with |
Sure, please take a look at the linked notebook. Basically, classes with slots are more compact and deterministic. However, if you don't define |
Note that all symengine classes deriving from Basic has only one attribute. The pointer to the C++ object. Cython extension classes like All the classes in symengine used to be Cython extension classes and then some were changed to be regular Python classes so that
Both should work. I'm not sure which is the best. I guess we can go with 1 and switch to option 2 if that doesn't work. Can you send a PR with the above change and a test case? |
Option 2. I can easily do, while for option 1. I feel that I know too little about symengine. However, if that is your preferred way I can make a suggestion and you can review it. |
Option 1 is basically changing |
I'm working on a package that makes heavy use of sympy and we would like symengine to be a drop-in replacement. Since in our context there might be anywhere from a few to hundreds of thousands of variables, I'd like to build the variables using
__slots__
.That approach works perfectly when inheriting from
sympy.Dummy
but unfortunately not when subclassing fromsymengine.Symbol
. (I'm building on top of symengine 0.3 so I couldn't findDummy
there.)Would it be hard for you to redefine your Python class interface to use
__slots__
?The text was updated successfully, but these errors were encountered: