在Cython中,如果我有:
cdef unsigned int i1[3]
cdef unsigned int i2[3]
i1 = [1, 2, 3]
i2 = [4, 5, 6]
ii = [i1, i2]
print(ii)
我得到了
[[1, 2, 3], [4, 5, 6]]
到目前为止一切顺利。现在,如果我有:
cdef unsigned char c1[3]
cdef unsigned char c2[3]
c1 = bytearray(b'123')
c2 = bytearray(b'456')
cc = [c1, c2]
print(cc)
或者:
cdef unsigned char c1[3]
cdef unsigned char c2[3]
c1 = bytearray(b'123')
c2 = bytearray(b'456')
cdef unsigned char *cc[2]
cc[0] = c1
cc[1] = c2
print(cc)
我明白了:
[b'123', b'456123']
我期待[b'123', b'456']
!这是怎么回事?