Sorry, you're right. I hadn't tried this with cython classes. Andrew On Sunday, 9 October 2016 12:43:10 UTC+11, Emmanuel Charpentier wrote: > > Sorry, that doesn't work with Sage's compiled classes : > > @add_method_to_class(sage.symbolic.expression.Expression) > def demoivre(self): > r""" > Wrapper for Maxima's demoivre() function > """ > return(maxima.demoivre(self).sage()) > @add_method_to_class(sage.symbolic.expression.Expression) > def exponentialize(self): > r""" > Wrapper for Maxima's exponentialize() function > """ > return(maxima.exponentialize(self)) > > TypeError Traceback (most recent call > last)<ipython-input-2-4582bdd144be> in <module>()----> 1 > @add_method_to_class(sage.symbolic.expression.Expression) 2 def > demoivre(self): 3 r""" 4 Wrapper for Maxima's demoivre() > function 5 """ > <ipython-input-1-e69e29b08a23> in add_func(func) 4 """ 5 > def add_func(func):----> 6 setattr(klass,func.func_name,func) 7 > return func 8 return add_func > TypeError: can't set attributes of built-in/extension type > 'sage.symbolic.expression.Expression' > > > I suppose that Nicolas wrote recursive-monkey-patches for a reason... It's > probably just me that doesn't understand how to create the modile (package) > containing the new definitions. > > -- > Emmanuel Charpentier >
-- You received this message because you are subscribed to the Google Groups "sage-support" 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
