[Twisted-Python] One big smile ...

Moshe Zadka m at moshez.org
Sun Jul 13 00:29:51 EDT 2003

> 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.

Right, I meant to write ".copy()". Thanks for the fix!

Moshe Zadka -- http://moshez.org/
Buffy: I don't like you hanging out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.
Agile Programming Language -- http://www.python.org/

More information about the Twisted-Python mailing list