instances

Why can't you add attributes to object in python?

Why can't you add attributes to object in python? Question: (Written in Python shell) >>> o = object() >>> o.test = 1 Traceback (most recent call last): File “<pyshell#45>”, line 1, in <module> o.test = 1 AttributeError: ‘object’ object has no attribute ‘test’ >>> class test1: pass >>> t = test1() >>> t.test Traceback (most …

Total answers: 2