|
|
|
|
|
by DeepDuh
5031 days ago
|
|
Right, of course it was the mutable use of an internal data structure. class Foo:
bar = [1]
foo1 = Foo()
foo2 = Foo()
foo2.bar.append(2)
print foo1.bar
print foo2.bar
prints
[1, 2]
[1, 2]And that's the reason why I don't like that the standard way I define common instance members is an init function. Are there any decorators I could use to do that outside of any class function? |
|