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

Comment (by nbruin):

 Replying to [comment:11 SimonKing]:
 > Note that the idea is to go up `self.__class__.mro()` on the one hand,
 and `self.category().parent_class.mro()`, on the other hand. The former is
 no problem, since self is an instance of its class and thus we don't need
 the `__func__` attribute. The latter is (currently, at least) no problem,
 since parent classes of categories are Python classes and thus have
 `__func__` on their methods. Or am I mistaken?
 Well, anything can be assigned to attributes in principle, regardless of
 whether something is a python class or not. Should we ever migrate to
 Python 3 then there are no unbound instancemethods at all: they are just
 plain functions there.

 So I'd say:
  * check if `__init_extra__.im_func` exists (this indicates an
 `instancemethod` object). If so, perhaps check if `__init_extra__.im_self`
 is None (unbound method). If it does, then call `im_func`.
  * otherwise, just call `__init_extra__`.
 It's hardly more coding work and should be far more robust.

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

Reply via email to