#9429: Undesirable behaviour when deriving from QuotientRingElement
-----------------------+----------------------------------------------------
Reporter: vbraun | Owner: AlexGhitza
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.5
Component: algebra | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------+----------------------------------------------------
Comment(by novoselt):
Hi Volker,
I think I need to clarify my position a bit. I think that the coercion
system is great and we should try to use it and comply with it as much as
possible, especially in new classes. However it is not yet implemented
everywhere and "fixing" existing files sometimes leads to a lot of
problems, which may have a simple solution, but it is not necessarily
obvious. I have tried today to switch divisor groups to the new framework
and discovered that all modules in Sage are still inherited from old-style
parents and trying to change it gives tons of errors. So if you are up to
determine the exact cause of the problems above and fix them - it would be
great (looks like the issue here is with `int` type, which should be
treated like `ZZ`), but at the same time I don't think it should be
mandatory.
Meanwhile, I am attaching a version of your first patch with `return
self.parent()(...)` statements. Naturally, `q^2` in your example will be
of type `QuotientRingElement` since this is what the parent of `q`
constructs as its elements. However, if you derive a class from
`QuotientRing` which will construct its elements as some other type, these
operations should return that other type. Please check if it actually
works for your patches (I checked that at least it does not break anything
so far). If it works, then perhaps we can add an example in the module
docstring with derived classes for both ring and element and then mark it
as ready for inclusion.
Thank you,
Andrey
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9429#comment:5>
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 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/sage-trac?hl=en.