I have an array of dictionaries that I want to reduce
foo = [{'value': 45}, {'value': 2}, {'value': 3}, {'value': 0}]
reduce(lambda x, y: x['value']+y['value'] , foo)
gives me the following error
TypeError: 'int' object has no attribute '__getitem__'
what I ended up doing was to first create a simple array using a comprehension.
reduce(lambda x, y: x+y, [x['value'] for x in foo])