#17480: Improve documentation of element.pyx
-------------------------------------+-------------------------------------
Reporter: cheuberg | Owner:
Type: defect | Status: needs_info
Priority: minor | Milestone: sage-6.5
Component: coercion | Resolution:
Keywords: documentation, | Merged in:
element | Reviewers: Samuel Lelièvre, Marc
Authors: Clemens Heuberger | Mezzarobba
Report Upstream: N/A | Work issues: rebase
Branch: | Commit:
u/cheuberg/ticket/17480-element- | 3cd404d02a8899ab97042e67d53a5c79cfa9b9e4
doc | Stopgaps:
Dependencies: #10779, #17533 |
-------------------------------------+-------------------------------------
Changes (by cheuberg):
* status: needs_work => needs_info
Comment:
Replying to [comment:18 jdemeyer]:
> This conflicts with #10779 and, to be safe, it should be rebased on
#17533 also.
Merged 6.5.beta6 (containing #10779) and resolved merge conflict.
#17533 does not produce a merge conflict, but merged it anyway to be on
the safe side.
>
> I also wonder about the statement
> {{{
> .. warning::
>
> In a *Cython* class, this has to be overridden as a ``cpdef``;
> otherwise, it won't get called. It is especially important to keep
> this in mind whenever you move a class down from Python to Cython.
>
> In *Python*, this has to be overridden as a ``def``.
> }}}
>
> I doubt that this is true and would simply remove this paragraph.
So that would mean that the
[http://www.sagemath.org/doc/reference/structure/sage/structure/element.html
#how-to-define-a-new-element-class old documentation] mentioning a `def
_add_` and a `cpdef _add_` with a similar warning was incorrect, too?
I tried the following:
{{{
sage: cython_code = """
....: from sage.structure.element cimport RingElement
....: cdef class MyCRingElement(RingElement):
....: def _add_(self, other):
....: print "My _add_ is called"
....: return 0"""
sage: cython(cython_code)
sage: b = MyCRingElement(ZZ)
sage: b._add_(b)
My _add_ is called
0
}}}
Therefore, I tend to remove the warning, as well as the whole `cpdef` vs.
`def` discussion. Before doing so, I'd like to hear other opinions
(Samuel?)
--
Ticket URL: <http://trac.sagemath.org/ticket/17480#comment:20>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.