pickle vs .pyc

Michael Hudson mwh21 at cam.ac.uk
Thu Jun 3 02:21:00 EDT 1999


Hrvoje Niksic <hniksic at srce.hr> writes:

> Michael Hudson <mwh21 at cam.ac.uk> writes:
> 
> > Random aside: something fishy's going on when I try to try to marshal
> > *arrays* (as opposed to mere lists):
> 
> The documentation for marshal says:
> 
>     Not all Python object types are supported; in general, only
>     objects whose value is independent from a particular invocation of
>     Python can be written and read by this module. The following types
>     are supported: `None', integers, long integers, floating point
>     numbers, strings, tuples, lists, dictionaries, and code objects
>     (...)

Yes, but usually you get an exception to show that somethings gone
awry:

>>> import md5
>>> marshal.loads(marshal.dumps(md5.md5()))
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: unmarshallable object
>>> class F:
...  pass
...
>>> marshal.loads(marshal.dumps(F()))
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: unmarshallable object

It's not that important I suppose, it's just odd.

Michael




More information about the Python-list mailing list