for c in listOfCs:
    ymap[c.Y].append(c)
print([(y, sum(c.Z for c in clist)) for y, clist in list(ymap.values())])
What's the most concise way in Python to group and sum a list of objects by the same property