首页 > 解决方案 > Cython 中的方法如何在 C 中实现?

问题描述

这可能是关于“C”而不是“Cython”的问题,但我试图了解类在 cython 中的工作方式。

当我在 Cython 中编写课程时:

cdef class Myclass:

    def __init__(self, a1, ...):
        self.attribute1 = a1

    def __cinit__(self, char *ca1,...):
        self.c_attribute1 = Ca1
        ...

我知道它基本上是 a struct in c

但是之后:

cdef muFunction(self):
    do and return something

对象的私有/本地方法如何?然后可以以C编译速度运行吗?

谢谢你,请随时指出并教我所有我可能错误使用的术语。

标签: cclassmethodscython

解决方案


推荐阅读