In python, instances of classes can have custom attributes set dynamically:
class A(object):
pass
a=A()
a.x=1
This, however, doesn't work if you instantiate object
object().x=1
#raises AttributeError: 'object' object has no attribute 'x'
object has no __dict__ attribute to store the custom attributes, so this doesn't work.
What's the easiest way to create a object where we can dynamically create custom attributes?
a=A()approach?