#13922: Avoid a regression in the creation of homsets
-------------------------------+--------------------------------------------
       Reporter:  SimonKing    |         Owner:  tbd         
           Type:  defect       |        Status:  needs_review
       Priority:  critical     |     Milestone:  sage-5.6    
      Component:  performance  |    Resolution:              
       Keywords:               |   Work issues:              
Report Upstream:  N/A          |     Reviewers:              
        Authors:  Simon King   |     Merged in:              
   Dependencies:  #715         |      Stopgaps:              
-------------------------------+--------------------------------------------

Comment (by SimonKing):

 Question to Robert: Is it possible to use a metaclass in Cython?

 I tried:
 {{{
 cdef class Test:
     __metaclass__ = ClasscallMetaclass
     @staticmethod
     def __classcall__(cls,data):
         print "classcall"
         O = super(cls,cls).__new__(cls,data)
         cls.__init__(O,data)
         return O
     def __init__(self, data):
         print "init"

 class Test2:
     __metaclass__ = ClasscallMetaclass
     @staticmethod
     def __classcall__(cls,data):
         print "classcall"
         O = super(cls,cls).__new__(cls,data)
         cls.__init__(O,data)
         return O
     def __init__(self, data):
         print "init"
 }}}

 While I obtain
 {{{
 sage: Test2('bla')
 classcall
 init
 <...Test2 object at 0x6128680>
 }}}
 I only get
 {{{
 sage: Test('bla')
 init
 <...Test object at 0x72eddc0>
 }}}
 with the Cython function. Hence, it compiles with the metaclass, but
 apparently it has no effect.

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

Reply via email to