Pickling slotted instances
Andrew McNamara
andrewm at object-craft.com.au
Thu Sep 12 00:35:22 EDT 2002
Instances using __slots__ can't be pickled - is there a fundemental reason
why this is so, or is it simply yet to be implemented?
At first glance, a __getstate__ for a slotted class could be as simple as:
def __getstate__(self):
attrs = [getattr(self, attr, None) for attr in self.__slots__]
return self.__slots__, attrs
What am I missing?
--
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
More information about the Python-list
mailing list