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_common_for_all_instances', but appended to it.
and how create array in class - normal array, "private variable"
1) it's called a list, not an array 2) you do that in the __init__ method: self.blabla = [] 3) still, it won't be a "private" attribute, just an instance attribute -- http://mail.python.org/mailman/listinfo/python-list
