cdef函数下可以引用Python对象吗?

Can Python object be referenced under cdef function?

在下面的代码中,self 是一个 python 对象,因为它是从 def 而不是 cdef 声明的。是否可以在 cdef 函数下引用 python 对象,就像它在下面示例中的 c_function 下的使用方式一样?

我很困惑,因为 cdef 听起来 cdef 是一个 C 函数,所以我不确定它是否能够接受 python 对象。

class A(self, int w):
   def __init__():
       self.a = w

   cdef c_function (self, int b):
       return self.a + b

谢谢,

我是OP。 来自“Cython:Python 程序员指南”:

来源:https://books.google.com.hk/books?id=H3JmBgAAQBAJ&pg=PA49&lpg=PA49&dq=python+object+cdef+function&source=bl&ots=QI9If_wiyR&sig=ACfU3U1CmEPBaEVmW0UN1_9m9G8B9a6oFQ&hl=en&sa=X&ved=2ahUKEwiBgs3Lw5vqAhXSZt4KHTs0DK0Q6AEwBHoECAoQAQ#v=onepage&q=python%20object%20cdef%20function&f=false

"[...] Nothing prevents us from declaring and using Python objects and dynamic variables in cdef functions, or accepting them as arguments"

所以我把这本书当作对我原来的问题说“是”的书。