Thanks for the suggestions! I'll probably go ahead and see if I can wrap the objects where needed.
Cheers, Nico On Monday, July 13, 2015 at 7:51:09 PM UTC+2, Aaron Meurer wrote: > > This is because SymPy uses __slots__ as a performance/memory optimization. > > One way to do this would be to create subclasses for the objects that > have the attributes you want. There are many issues in SymPy with > things not working properly with subclasses, though (but they are bugs > and need to be fixed). > > Another way might be to put them in the assumptions0 dictionary. I > think that might only support boolean attributes, though. > > Of course, another option would be to store the attributes separately. > > Aaron Meurer > > On Mon, Jul 13, 2015 at 6:22 AM, Nico <[email protected] <javascript:>> > wrote: > > Hi everyone, > > > > Given a symbolic expression (e.g., "laplace(u) + lambda * u), I'm > parsing > > that expression to generate code for a particular HPC framework. Up > until > > now, I'm using custom objects and Python's own AST module to parse the > > syntax tree. SymPy, however, could add functionality, so right now I'm > > evaluating if it's feasible for me to transition to using SymPy objects > for > > expressions. > > > > In the custom parser, I'm adding attributes to nodes to pass around > > information. For sympy objects, this is not possible since they don't > have a > > __dict__. Is there any other way to embellish SymPy objects (such as > Add, > > Symbol) with extra attributes? > > > > Cheers, > > Nico > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sympy" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > Visit this group at http://groups.google.com/group/sympy. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/sympy/ee33f72a-7986-4451-8035-623086b28420%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/647adc38-e50e-4a9c-81fc-87cc9fe5ee15%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
