[Pyrex] Serialization of a wrapped C structure

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jul 30 01:53:44 CEST 2007


Samuele Kaplun wrote:
> How can I reach a binary sequence of data in memory to 
> serialize it? 

I'm not sure, but if you equip your type with a buffer
interface, that might enable you to pass it directly
to struct.pack without requiring an intermediate string
copy.

You would also probably be able to pass it directly
to the write method of a file object, if that would
help. That would be even more efficient as it would
eliminate copying altogether.

--
Greg



More information about the Pyrex mailing list