Hi,
I've only just started using Cython today, and I'm having trouble with
the buffer interface indexing described here:
http://wiki.cython.org/enhancements/buffer . I want to iterate over a
unicode string getting contiguous subsequences.

My Cython function has the following declaration:

def parseDoc(object[object] string):

I've tried various Python types, but I always get a runtime error like:

TypeError: 'unicode' does not have the buffer interface
TypeError: 'array.array' does not have the buffer interface
TypeError: 'buffer' does not have the buffer interface

The last one was obtained by calling the built-in buffer() function on
the string.

I can get a step further by doing cimport numpy and using a numpy
array, but then unicode is not one of the supported types, and that
doesn't seem like it was the intention --- the docs suggest at Python
2.6+, I shouldn't need the numpy work-around.

What am I doing wrong?

Matthew.

P.S. I tried to post this yesterday but it didn't seem to come up.
Apologies if this double-posts.
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to