Cédric Lucantis <[EMAIL PROTECTED]> wrote: > Here self is only a local variable and its meaning is only a convention. So > assigning it to a new value won't change the object itself (and is not a good > idea as it may be confusing for the reader).
Thanks, i was thinking about something like that. > You should either use a static method which returns a new object: > > class Prefs (object) : > > def save (self, f) : > pickle.dump(self, f) > > @staticmethod > def load (f) : > return pickle.load(f) > > and load it with "prefs = Prefs.load(filename)" > > or store all the values in a dictionary and only pickle this object: > > class Prefs (object) : > > def __init__ (self) : > self.values = { 'test': 1, ... } > > def save (self, f) : > pickle.dump(self.values, f) > > def load (self, f) : > self.values = pickle.load(f) I try the staticmethod, it works fine. Very helpful. But i don't like it very much, it seems 'complicated' (python was supposed to be simple). I'll also try the dictionnary method. My final idea was that a dictionnary would be perhaps simple in the future to save/load as XML and a parser. But perhaps i'm wrong with my vision of python. On a more global perspective, what are the best method to implement a simple config file with pyhton. Assuming i finally want to made a bundle app for Mac, Windows and perhaps Linux. I develop on Mac, and on this platform the config fil (preferences) have to be stored in a special directory : ~/Library/Preferences, no problem. But on other platform that's not the same directory and perhaps i would also faced to permissions issues... But first is there a way to determine on which platfrom the python script is running ? -- Pierre-Alain Dorange Vidéo, DV et QuickTime <http://www.garage-video.com/> Clarus, the DogCow <http://clarus.chez.tiscali.fr/> -- http://mail.python.org/mailman/listinfo/python-list