Re: Pickle a list

2011-03-08 Thread Irmen de Jong
On 07-03-11 17:38, Rogerio Luz wrote: import sys import pickle class MyClass: teste = 0 nome = None lista = ["default"] def __init__(self): for reg in range(1,10): self.lista.append(reg) ^^ This probably doesn't do w

Re: Pickle a list

2011-03-07 Thread Chris Kaynor
Chris 2011/3/7 Rogério Luz > Chris, Thanks a lot for your explanation, I got it > > class MyClass: > #class variables > > teste = 0 > nome = None > lista = ["default"] > > def __init__(self): > #instance variables > self.lista = MyClass.lista # if I still wa

Re: Pickle a list

2011-03-07 Thread Chris Kaynor
On Mon, Mar 7, 2011 at 8:38 AM, Rogerio Luz wrote: > Hi All > > I'd like to pickle an object instance with all values. So I > instanciate myClass and set some values including a list with more > values (in the __init__), then dump to file. I realized that the > pickled object don't saved my new li

Pickle a list

2011-03-07 Thread Rogerio Luz
Hi All I'd like to pickle an object instance with all values. So I instanciate myClass and set some values including a list with more values (in the __init__), then dump to file. I realized that the pickled object don't saved my new list values (saved only the "default" value) but saved a String a