[Python-Dev] buffer objects
Scott Gilbert
xscottg@yahoo.com
Thu, 2 May 2002 08:49:01 -0700 (PDT)
--- Fredrik Lundh <fredrik@pythonware.com> wrote:
>
> umm. pickles are supposed to be machine-independent, so how can you
> pickle stuff built on buffers *without* taking types/sizes/endianess into
> account?
>
:-)
It's not that I, personally, wouldn't have to take type/size/endianness
into account if I built something on top of a buffer in which
type/size/endianness matters. It's that I wouldn't have to get a concensus
from anyone else on how to do so.
I'd define my __getstate__/__setstate__ for a class to work with a tuple of
(type, endian, size, buffer, ...) if needed, and someone else could define
theirs however fit their needs. The buffer itself would just pickle from
mutable-bytes to mutable-bytes (hopefully with the same alignment that
malloc provides for the native machine).
Cheers,
-Scott
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com