#15718: Implement the __init_extra__ protocol of categories for Cython classes.
------------------------------+------------------------
       Reporter:  nthiery     |        Owner:
           Type:  defect      |       Status:  new
       Priority:  major       |    Milestone:  sage-6.4
      Component:  categories  |   Resolution:
       Keywords:              |    Merged in:
        Authors:              |    Reviewers:
Report Upstream:  N/A         |  Work issues:
         Branch:              |       Commit:
   Dependencies:              |     Stopgaps:
------------------------------+------------------------

Comment (by SimonKing):

 Very strange. The following does not work, even in Python:
 {{{
             sage: from sage.structure.element import RingElement
             sage: class E(RingElement):
             ....:     def __init__(self, P, n):
             ....:         self.n = n
             ....:         RingElement.__init__(self, P)
             ....:     def _repr_(self):
             ....:         return "<{}>".format(self.n)
             ....:     def _mul_(self, other):
             ....:         return self.parent()(self.n*other.n)
             ....:     def _add_(self, other):
             ....:         return self.parent()(self.n+other.n)
             ....:     def _lmul_(self, other):
             ....:         return self.parent()(self.n*other)
             sage: class P(Parent):
             ....:     Element = E
             sage: p = P(base=ZZ, category=Algebras(ZZ))
             sage: p.has_coerce_map_from(ZZ)
             False
 }}}
 I found that `UnitalAlgebras.ParentMethods.__init_extra__` is called.
 However, it is claimed that the (absence of a) coerce map from ZZ has
 already been cached, which means that the clearly existing coercion via
 multiplication with `p.one()` is not registered.

 At what point is a coercion from ZZ requested *before* calling
 `__init_extra__`?

--
Ticket URL: <http://trac.sagemath.org/ticket/15718#comment:18>
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.

Reply via email to