Hi, 

In Sage, the reflected division operator, __rdiv__, seems not to behave as 
the other reflected operators, __radd__, __rsub__ and __rmul__: it 
generates an error in the following example: consider the simple class:
 
class A(SageObject):
    def __init__(self, x):
        self.x = x

    def __radd__(self, other):
        return other + self.x
    
    def __rsub__(self, other):
        return other - self.x
    
    def __rmul__(self, other):
        return other * self.x
    
    def __rdiv__(self, other):
        return other / self.x

We get:
sage: a = A(2)
sage: 3+a ; 3-a; 3*a
(5, 1, 6)
as expe


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to