access string data from within cython
sturlamolden at yahoo.no
Wed Aug 5 23:51:12 CEST 2009
On 5 Aug, 23:22, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> And that gives me the *full* bytestring, not only until the first zero?
> I can't try that right now (not at work anymore), but if it's that easy,
> that would be great.
It should, and if it does not it is a bug in Cython. The len()
function should work similarly in Python and Cython: It should just
call the object's __len__ method. Cython has no idea that your Python
object bytestring is a byte string, nor does Cython care.
>>> bs = '\x00'*10 # bytes string with 10 zeros
More information about the Python-list