[MATRIX-SIG] cPickle/shelve and Numeric

Jim Fulton jim@digicool.com
Tue, 13 Jan 1998 06:46:25 -0500

Bruce Duncan wrote:
> Is there a version of cPickle/shelve for Numeric?
> If not, what is the best way to store arbitrary python objects (that
> may contain Numeric arrays) to dbm-style database files?

cPickle supports pickling objects of any type, including Numeric arrays, 
however, cPickle's strategy is inefficient for arrays larger than a
few megs. Also, to use cPickle with a non-standard type, you have 
to define a "reduction" function or method that and constructor that
converts the non-standard type to and from standard types. This is
not hard. See the cPickle documentation for details and contact me if
you have any questions.

I'd like to see something done about the inefficiency problem for
large arrays.  I've come up with a few ideas, but don't have time to
work on this.  If anyone wants to work on this, I'd be happy to work
with them and (probably) incorporate their change into the cPickle


Jim Fulton           mailto:jim@digicool.com
Technical Director   (540) 371-6909              Python Powered!
Digital Creattions   http://www.digicool.com     http://www.python.org

MATRIX-SIG  - SIG on Matrix Math for Python

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