pickle alternative

simonwittber at gmail.com simonwittber at gmail.com
Tue May 31 03:34:39 EDT 2005


> For simple data types consider "marshal" as an alternative to "pickle".

>From the marhal documentation:
Warning: The marshal module is not intended to be secure against
erroneous or maliciously constructed data. Never unmarshal data
received from an untrusted or unauthenticated source.

> BTW, your code won't work on 64 bit machines.

Any idea how this might be solved? The number of bytes used has to be
consistent across platforms. I guess this means I cannot use the struct
module?

> There's no need to compute str(long) twice -- for large longs
> it takes a lot of work to convert to base 10.  For that matter,
> it's faster to convert to hex, and the hex form is more compact.

Thanks for the tip.

Sw.




More information about the Python-list mailing list