On Jan 4, 8:17 pm, Dima Pasechnik <dimp...@gmail.com> wrote:
> > The abs() method is defined in sage.structure.element.RingElement. If
>
> but why? not all rings have any meaningful abs()..
>
> > that method makes sense for your specific class of ring elements,
> > implement a method __abs__.

Perhaps more importantly: What is to be gained with the added
indirection of abs through __abs__ if the implementation *really* is
just:

    def abs(self):
        return self.__abs__()

I can see how binary ops win something because there's another
argument that might need some preprocessing. For single argument
methods such as abs(self), you already know exactly what self is going
to look like. Is there any scenario thinkable where the indirection
from abs to __abs__ yields an advantage?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to