I have a python class like this
class Car(Base):
def __init__(self, details):
for field,value in details.iteritems():
self[field] = value
and I call it like this
car_details['make'] = 'Dodge'
car_details['model'] = 'Ram'
car = Car(car_details)
however it fails with
TypeError: 'Car' object does not support item assignment
I am trying to set it up, so I can then just use car.make once the class has been init.
you’re looking for
setattr():