You can use sum()
to add your booleans; True
equal to 1 in a numerical context, False
equal to 0:
sum(d['success'] for d in s)
This works because the Python type bool
is a subclass int
for historical reasons.
If you want to make this explicit, you can use a conditional expression, but from my point of view, readability will not improve:
sum(1 if d['success'] else 0 for d in s)