Apart from the performance, there is a significant semantic difference between the two codes. only one object is referred to in case of class attribute whereas there can be multiple objects referred to in case of instance-attribute-set-at-instantiation.
For example :
1. class A: foo = []
a, b = A(), A()
a.foo.append(3)
b.foo
2. class A:
def __init__(self): self.foo = []
a, b = A(), A() a.foo.append(3)
b.foo