I would like to do this in Cython:

    sage: class Fruit(object):
    ....:     @staticmethod
    ....:     def yo(a):
    ....:         return a
    ....:     def using_yo(self, a):
    ....:         return self.yo(a)
    sage: f = Fruit()
    sage: f.using_yo(1)
    1

But it does not work (why?) :

    sage: cython("""
    sage: cdef class Fruit(object):
    ....:     @staticmethod
    ....:     cdef yo(a):
    ....:         return a
    ....:     def using_yo(self, a):
    ....:         return self.yo(a)
    sage: """)
    RuntimeError: Error converting tmp_PUV0E1.spyx to C:


    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    cdef class Fruit(object):
        @staticmethod
        cdef yo(a):
            return a
        def using_yo(self, a):
            return self.yo(a)
                         ^
    ------------------------------------------------------------

    _9165_tmp_PUV0E1_spyx_0.pyx:12:22: Cannot call a static method on an 
instance variable.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" 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-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to