[PYTHON MATRIX-SIG] Pickling arrays
Jim Fulton
jim.fulton@digicool.com
Wed, 02 Oct 1996 14:16:54 -0400
Konrad Hinsen wrote:
>
> Recently seen on my computer screen:
>
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> File "/usr/tmp/pythona05330", line 42, in ?
> pickle.dump(h, file)
> File "/usr/local/lib/python1.4/pickle.py", line 547, in dump
> Pickler(file).dump(object)
> File "/usr/local/lib/python1.4/pickle.py", line 189, in dump
> self.save(object)
> File "/usr/local/lib/python1.4/pickle.py", line 208, in save
> raise PicklingError, \
> pickle.PicklingError: can't pickle 'array' objects
>
> Didn't this work at some point?
Not without a modified pickle module.
> Should it work? Should I do something
> else?
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.
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.
Jim
--
Jim Fulton Digital Creations
jim@digicool.com 540.371.6909
## Python is my favorite language ##
## 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
=================