Why do i need
class DummyObject(object): pass
to make
dummy = DummyObject() dummy.foo = 42
Why is this not legal in Python?
dummy = object() dummy.foo = 42
Which gives an error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'object' object has no attribute 'foo'
python
Georgi Kremenliev
source share