On Sep 13, 5:48 pm, Jon Clements wrote:
> On 13 Sep, 15:19, Bahadir wrote:
>
>
>
> > Hi,
>
> > I have a class:
>
> > class second:
> > a = None
> > b = None
>
> > class first:
> > array = []
>
> > I populate the array in first class with instances of second, then
> > save by:
>
> > sh
Bahadir wrote:
> Also there are no errors printed out.
>
> Any idea why the array of instances are lost?
>
The pickle protocol doesn't pickle class attributes by default, only
instance variables. You list called 'array' is a class variable -- it's
bound to the class not your instance.
By the wa
On 13 Sep, 15:19, Bahadir wrote:
> Hi,
>
> I have a class:
>
> class second:
> a = None
> b = None
>
> class first:
> array = []
>
> I populate the array in first class with instances of second, then
> save by:
>
> shelve = shelve.open(),
> shelve["first"] = myfirst
> shelve.close()
>
Hi,
I have a class:
class second:
a = None
b = None
class first:
array = []
I populate the array in first class with instances of second, then
save by:
shelve = shelve.open(),
shelve["first"] = myfirst
shelve.close()
When I reopen the shelve from another script, the first class is