Python类可以具有类属性:
class Foo(object):
bar = 4
在Cython扩展类型中是否有类似的构造来定义类属性?例如,当我试图编译以下cython代码时
cdef class Foo:
cdef int bar
bar = 4
我得到这个错误:
thing.c:773:3: error: use of undeclared identifier 'bar'
bar = 4;
^
1 error generated.
error: command 'cc' failed with exit status 1
Tags:
目前没有回答
相关问题 更多 >
编程相关推荐