[Twisted-Python] One big smile ...
Bob Ippolito
bob at redivi.com
Sat Jul 12 17:47:37 MDT 2003
On Saturday, Jul 12, 2003, at 19:05 America/New_York, Moshe Zadka wrote:
> You also want to avoid persisting nextCall
>
> def __getstate__(self):
> d = self.__dict__
> if 'nextCall' in d:
> del d['nextCall']
> return d
Note that you shouldn't actually do it like that, you should do it like
this:
def __getstate__(self):
d = self.__dict__.copy()
if 'nextCall' in d:
del d['nextCall']
return d
It's never ever a good idea to _break_ your live instances the instant
they get serialized.
-bob
More information about the Twisted-Python
mailing list