Pickling array.array
Nicolas Fleury
nid_oizo at yahoo.com_remove_the_
Fri May 14 11:16:18 EDT 2004
Hi,
Does anyone know if arrays would be picklable in python 2.4? Until
then, I tried to derive from array.array and add __setstate__ and
__getstate__ with the following code, but it seems I'm not doing it
correctly. Any idea what I'm doing wrong?
Thx and Regards,
Nicolas
import array as arr
class array(arr.array):
def __getstate__(self):
return {'buffer': self.tostring()}
def __setstate__(self, dict):
self.fromstring(dict['buffer'])
More information about the Python-list
mailing list