In Python I've got a list of objects which have a
count = 0
for the_obj in obj_list:
count += the_obj.count()
You can use the built-in
sum() with a generator to sum the individual counts.
count = sum(obj.count() for obj in obj_list)
from operator import add, methodcaller count = reduce(add, map(methodcaller('count'), obj_list))