[PYTHON MATRIX-SIG] pickle error on Win95

James Hugunin jjh@Goldilocks.LCS.MIT.EDU
Wed, 20 Mar 96 10:22:55 EST


   >  Hey, you've forgot the "b" flag!  The following should work:
   [...]
   >   Since text and binary files are not the same thing under DOS (and
   > some other systems as well), you should always make sure to add "b"
   > when dealing with binary data.  See open() in the python manual for
   > details.

   On the other hand, pickle *used* to be a text-only format, which is
   fine with 'r' and 'b'.  But I presume that numerical arrays may be
   written in a more efficient binary form?

   --Guido van Rossum <guido@CNRI.Reston.VA.US>
   URL: <http://www.python.org/~guido/>

I've been waiting for somebody to notice this and properly castigate
me for violating the beauty of pickle's text-only format.

There are some major size and speed savings to be realized by dumping
large arrays in a binary format.  Since dumping 1 MB arrays to disk is
not all that uncommon, these things are unfortunately an issue.

This is the first time that anybody's noticed problems with the binary
format, and it seems a simple enough matter to add warnings that
matrices should only be pickled to binary format files.  Other than
this, I've found the binary format to work quite well for archiving
arbitrary objects that contain matrices across many platforms
(big/little endian) and even for passing these objects across sockets.

Anybody know a way I can add a check to the matrix pickling routines
to determine if they're writing to/reading from a binary format file
and raise an exception otherwise?

-Jim

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================