windows to linux pickled objects?

brueckd at tbye.com brueckd at tbye.com
Wed Nov 28 15:54:21 EST 2001


On 28 Nov 2001, Fernando Pérez wrote:

> Stephen Boulet <stephen at theboulets.net> wrote in message news:<u09p8h73vhth04 at corp.supernews.com>...
>
> > I tried it on linux and the program did run, but the size of the pickled
> > file only went down from 8183905 bytes to 8180057 bytes, and the file
> > wasn't binary at all. Maybe the size difference can be explained by the
> > lack of carriage returns.  ;)
> >
> > It would be nice if the binary option worked on linux...
> >
>
> Just to clarify, what I meant was binary *pickle*, not binary file
> write. Pickling in binary should decrease file size by quite a bit
> (think of it: a float is 8 bytes long, but can take about 16-18
> characters to print as text).

Binary usually helps, but it can work against you too:

>>> import pickle
>>> len(pickle.dumps(5.0))
6
>>> len(pickle.dumps(5.0, 1))
10

-Dave





More information about the Python-list mailing list