N
Nicolas Fleury
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'])
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'])