[PYTHON MATRIX-SIG] Suggestion for pickle

viennet@ura1507.univ-paris13.fr viennet@ura1507.univ-paris13.fr
Fri, 28 Mar 1997 22:15:21 +0100

 I'm not totally satisfied with the current interaction between the
pickle module and NumPy.

 Numeric.py defines two sub-classes, Pickler and Unpickler to be able
to pickle/unpickle NumPy arrays. One can use these classes in the
following way: 

from Numeric import *
a = array( [1,2,3,7], Float32 )
p = Pickler( open( 'test.pck', 'w' ) )
p.dump( a )

 But NOT using the standard pickle.Pickler and pickle.Unpickler
classes, which is sometimes annoying.
I suggest to directly modify the original classes: just add

pickle.Unpickler = Unpickler
pickle.Pickler = Pickler

at the end of Numeric.py

Comments ?


Emmanuel Viennet: <viennet@ura1507.univ-paris13.fr>
LIPN - Institut Galilee - Universite Paris-Nord       
93430 Villetaneuse -  France

MATRIX-SIG  - SIG on Matrix Math for Python

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