On Dec 28, 2007 2:37 PM, kent-and <[EMAIL PROTECTED]> wrote:
>
>
>
> 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 ?

I think this is fixed in sympy now. If not, please let us know.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected]
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