I am using the object function (object()) to make an object without a class in Python but it does not have any attributes or arguments, so I am trying to customise it by creating a variable like thing = object() and then using setattr(thing, 'name', 'Marco') but it won't let me because it throws an error saying:
>>> thing = object()
>>> setattr(thing, 'name', 'nothing')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'object' object has no attribute 'name'
How do I get past this?
I don't get why it does this when object can't have attributes but the object function can (object()) and then it throws AttributeError when I try to set an attribute for the object that is assigned to the variable when the whole point of using setattr() is to set attributes lol