Mohamed Lrhazi wrote:
> I see that Python has Buffer Objects and in 2.7/3.0 Memoryview
> Objects, for this purpose...
> Are those the facilites I need to learn and use? or does Cython
> provide its own tools?
> 
> By "data" I mean complex data structures, like arrays of iovec
> structs, or long "text" defined by indexes/offsets and lengths.
> 
> I need to learn how to provide my Python user with read and write
> access to such data.

It's impossible to answer this in general, but it's usually a good idea to
provide some kind of object oriented API to Python users, instead of just
copying the C-API. For example, if you are working on a large memory area
that has some kind of repetitive structure (like an array), you might want
to provide the user with an object that holds this memory and that uses
normal indexing to access each element. Each element might then be
represented by another type of object through which users can manipulate
it. Or, maybe you want to represent the data as a matrix of data entries. Or...

It really just depends on what you want to enable users to do with your
data. Try to come up with good use cases and design your API around those.

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to