On 28 Des, 10:18, Pearu Peterson <[EMAIL PROTECTED]> wrote:
> On Dec 28, 9:11 am, kent-and <[EMAIL PROTECTED]> wrote:
>
>
>
> > class Foo:
>
> >     def __init__(self):
> >         self.field = 1.0
>
> >     def __mul__(self, other):
> >         print "Multiplication in Foo from right"
> >         self.field = self.field * other
>
> >     def __rmul__(self, other):
> >         print "Multiplication in Foo from left"
> >         self.field = other * self.field
>
> > f = Foo()
>
> > f*x # works
> > x*f # works
>
> > f*y # works
> > y*f # does not work
>
> > What should I do about this ?
>
> Try deriving Foo from sympy.Basic. Actually the __mul__ code in sympy
> is broken as it should return NotImplemented when it gets an
> unknown (to sympy) object as an right hand side.

Is this the only way,  sympy.Basic might try to use the other objects
rmul ?

>
> Btw, arithmetic operations in sympycore are about 4x faster than
> in sympy and I am currently working on sexpr support (based on
> Fredrik's research) which should give speedups upto 10x in arithmetic
> operations.
>

Great, I will have a look at sympycore.

Kent
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to