[PYTHON MATRIX-SIG] Pickling arrays

Konrad Hinsen hinsen@ibs.ibs.fr
Thu, 3 Oct 96 10:10:01 +0100


> > Didn't this work at some point? 
> 
> Not without a modified pickle module.

Then that's what we had once. I found some old code which used pickle to
store some complicated list whose elements included arrays, and I know
it worked...

> The pickle module in 1.4 will allow built-in objects that
> behave like instances to be pickled.  Objects must have a
> __class__ attribute that is bound to a callable object that
> is not a python or C function.

I wonder what the point of the last restriction is - if a C function
were acceptable, then it would be straightforward to implement a fake
class attribute.

> In a couple of weeks I will release an "Extension Class"
> module that will, among other things, facilitate building 
> built-in types that behave like classes and whos instances
> behave like python instances.  In particular, built-in 
> instances based on extension classes will be picklable.
>
> The primary benefit of extension classes is that they
> can be subclassed in Python.

Sounds like what I have always wanted...

Of course the solution that Jim (the other one) pointed out works, but
if for every new C type someone writes a specialized pickle
look-alike, we will end up with a big mess and no way to pickle
e.g. lists that contain various such types.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-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
=================