I'm looking for a way to update an attribute programmatically (especially when inside an update()
function of an SQLAlchemy class)
def update(self, **kwargs):
for kwarg in kwargs:
setattribute(self, kwarg, kwargs[kwarg])
This does not seem to work, neither this:
def update(self, **kwargs):
for kwarg in kwargs:
self[kwarg] = kwargs[kwarg]