[MATRIX-SIG] cPickle/shelve and Numeric
Konrad Hinsen
hinsen@ibs.ibs.fr
Tue, 13 Jan 1998 17:47:04 +0100
> 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?
For the moment, use the pickler/unpickler defined in module Numeric
and put the result. I can think of a few ways to use it in shelve,
all of which untested, of course:
1) The "quick hack" solution:
import shelve
from Numeric import Pickler, Unpickler
shelve.Pickler = Pickler
shelve.Unpickler = Unpickler
2) Somewhat better: make a new module, called e.g. "array_shelve",
and containing
from shelve import *
from Numeric import Pickler, Unpickler
3) Subclass everything from shelve and replace the methods referring
to Pickler or Unpickler.
Konrad.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale | Fax: +33-4.76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________