我对带有cython类的Tab感兴趣(请参阅下文)。 制表符完整仅在第一级起作用:
A1 = A()
A1. <= Tab shows now optimizer
A1.optimizer. <= Tab shows nothing :(
以下我的Cython类缺少哪些功能,Tab完全可以使用?常规Python类也是如此吗?
cdef class optimizer():
cdef:
uint32_t u32_error
def __init__(self):
pass
def __cinit__(self):
self.u32_error = 0
def __dealloc__(self):
pass
cdef uint32_t u32_calc_error(self, bool_t* x, bool_t* ref, uint32_t N):
return 42
cpdef uint32_t optimize(self):
#self.u32_calc_error
self.u32_error += 1
return self.u32_error
@property
def error(self):
return self.u32_error
cdef class A(B):
"""
File: A.pxd
'Optimizer'
cdef class A(B):
...
...
"""
cdef:
public optimizer optimizer
def __cinit__(self, int N = 1):
self.optimizer = optimizer()
def __dealloc__(self):
pass
def __init__(self, int N = 1):
super().__init__(N = N)