Class Persistence using __dict__

Alex cut_me_out at hotmail.com
Mon Sep 4 10:32:19 EDT 2000


Usually, when I want to make a class persistent, I just pickle the
class:

class Test:

    def Save(self, fn):
        cPickle.dump(self, open(fn, 'w')

I only have to do something more elaborate when the class contains a
data structure that pickle doesn't know how to deal with.

HTH.
Alex.

-- 
The chain of destiny can only be grasped one link at a time.  
-- Sir Winston Churchill



More information about the Python-list mailing list