John Cremona wrote: > Thanks for the suggestion. But it does not work for me. Even though > b.__rmul__(2) works , as do b.__mul__(2) and b.__lmul__(2) and b*2, > 2*b still gives the error: non of my own mul functions are getting > seen, it goes straight for the default which fails. > > I just discovered that int(2)*b does work! > > I would love to know if this is a bug or a feature of coercion. > > Of course, it is probably my own fault for trying to get an additive > group whose elements are of type MultiplcativeGroupElement.... but > this is the *only* thing which does not work. > > John >
Here a few unintelligent comments from someone who does not understand what is going on even more than David... :) Basically, my guess/suggestion is: Does implementing your multiplication function as b._r_action() work? int(2)*b works since int(2) is a python object, and so python calls b.__rmul__(2) automatically. However, if you have an element that is part of the coercion framework, things are not quite so simple, apparently. This reminds me of a bug from a while ago, which probably does not directly help since presumably both of your objects live in the coercion system, but anyways: http://trac.sagemath.org/sage_trac/ticket/2283. The comment about _r_action() on that ticket might shed some light here. I have absolutely no idea how things are handled in the new coercion framework. Thanks, Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---