#19937: Implement generic __div__ and _div_ in the Magmas.Unital category
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-7.1
Component: categories | Resolution:
Keywords: coercion | Merged in:
Authors: Nicolas M. ThiƩry | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/nthiery/implement_generic___div___and__div__in_the_categories|
de58229ea4e66818a8f73d2c7c0fb35d344313b7
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nthiery):
Hi Vincent, Jeroen,
Thanks for the pointer to the discussion on sage-devel. I'll mention
this ticket there.
Due to the lack of multiple inheritance in Cython, we cannot have a
common Cython base class for all parents having the appropriate
multiplicative structure to define `__div__`. Besides there are
parents where you only know at initialization time whether they have
that appropriate structure; the elements of those can there only
inherit statically from Element.
Because of this, putting the `__div__` method in `RingElement` and its
variants (`MultiplicativeGroupElement`, ...) is not sufficient to cover
all the use cases. Having `__div__` there also encourages people to
inherit
from `RingElement` with no mathematical justification (see
e.g. `GapElement` in libgap). Hence the need to have a copy of this
method in the categories.
An alternative option would indeed be to move all the `__div__`,
`__mul__`, ... methods in `Element`. This has the advantage of
enabling coercion for every Sage `Element`. This has the disadvantage
of plotting the namespace of many objects with irrelevant methods.
I don't have a strong opinion myself.
In any cases, `_div_` belongs to this category and this ticket solves
the problem for now in a consistent way with what's done for the
additive structure and friends. It's also trivial to remove/move the
`__div__` method it defines. Therefore, unless moving `__div__` and
friends to `Element` is decided and implemented very quickly, I
suggest that we get this ticket in. I need this feature for the
Sage-GAP interface enhancements I am working on right now in St
Andrews.
Cheers,
Nicolas
--
Ticket URL: <http://trac.sagemath.org/ticket/19937#comment:7>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.