Hi Javier,

On 7 Dez., 07:30, Florent Hivert <florent.hiv...@lri.fr> wrote:
> I think the reason for the failure is that your code assumed that other is
> also a conjugacy class.

You *can* assume that, if you use the base classes in
sage.structure.element and sage.structure.parent!

But I wonder: Is your code Cython or Python? And do you use Sage's
coercion model properly?

Namely, look into sage/structure/element.pyx. There is a comment
explaining what you need to do for comparison in Python or in Cython
(that's different, unfortunately!).

The comment is

 
####################################################################
    # For a derived Cython class, you **must** put the following in
    # your subclasses, in order for it to take advantage of the
    # above generic comparison code.
Meaning: It is not enough that the methods following the comment are
inherited - you must explicitly repeat them, if you use Cython.

    # For a *Python* class just define __cmp__ as always.
    # But note that when this gets called you can assume that
    # both inputs have identical parents.
    #
    # If your __cmp__ methods are not getting called, verify that the
    # canonical_coercion(x,y) is not throwing errors.
    #
 
####################################################################

So, Python is a little easier.

But in both cases, it is also assumed that you are using coercion.
Hence, when the test "self==None" raises an error or returns a wrong
result then it could also be that there is a wrong coercion.

Best regards,
Simon

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to