Re: array in class

2008-05-13 Thread Diez B. Roggisch
alefajnie wrote: > class A: >this_is_original_variable_only_for_one_inctance = 0 > >def __init__(self, v): >self.this_is_original_variable_only_for_one_inctance = v > > > class B: > this_is_common_for_all_instances = [] > > def __init__(self, v): > self.this_is_common_for_a

Re: array in class

2008-05-13 Thread Marco Mariani
alefajnie wrote: class B: this_is_common_for_all_instances = [] def __init__(self, v): self.this_is_common_for_all_instances.append(v) now I can create some instances of B, but all of them have the same array, why Because you didn't reassign the attribute 'this_is_