python one-liner
No need to double up on the sum()
calls
total = sum(v.amount for ob in self.oblist for v in ob.anotherob)
You can just collapse the for
loop into another level of comprehension:
total = sum(sum(v.amount for v in ob.anotherob) for ob in self.oblist)