Re: Pickling an instance of a class containing a dict doesn't work

2006-10-13 Thread Marco Lierfeld
Peter Otten wrote: > Chances are you have inadvertently created an /instance/ attribute > build_steps which was then saved: > > s = subproject() > # ... > s.configuration["name"] = "my dinner" # modifies the class attribute > s.build_steps = ["hunt", "kill", "cook"] # creates an instance attribut

Re: Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Peter Otten
Marco Lierfeld wrote: > Jon Clements wrote: > >>> if you change the above to: >>> >>> class subproject: >>> def __init__(self): >>> configuration = { } >>> build_steps = [ ] >> >> Of course, I actually meant to write self.configuration and >> self.build_steps; d0h! > > Thank

Re: Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Marco Lierfeld
Jon Clements wrote: >> if you change the above to: >> >> class subproject: >> def __init__(self): >> configuration = { } >> build_steps = [ ] > > Of course, I actually meant to write self.configuration and > self.build_steps; d0h! Thank you Jon and Paul, you both were 100% ri

Re: Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Paul McGuire
"Marco Lierfeld" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello there, > > I want to save an instance of a class containing a dictionary with the > pickle-module. > > The class looks like this: >class subproject: >configuration = {} >b

Re: Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Jon Clements
Jon Clements wrote: > if you change the above to: > > class subproject: > def __init__(self): > configuration = { } > build_steps = [ ] Of course, I actually meant to write self.configuration and self.build_steps; d0h! -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Jon Clements
Marco Lierfeld wrote: > The class looks like this: > class subproject: > configuration = {} > build_steps = [] > # some functions > # ... > > Now I create an instance of this class, e.g. > test = subproject() >

Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Marco Lierfeld
Hello there, I want to save an instance of a class containing a dictionary with the pickle-module. The class looks like this: class subproject: configuration = {} build_steps = [] # some functions # ... Now I create an