Class attributes vs instance attributes
- dictionary
- mutable
- list
- class
Class attributes are shared across all instances of a class. This can be advantageous when used correctly but often will trip up new users.
class A(object):
data = []
a1 = A()
a1.data.append(1)
a2 = A()
print(a2.data)
# [1]