
Yes. I'd make that prettier with
def onSuccess(results, item): d = item.doSomethingElseThatReturnsDeferred() return d ... for item in list: d.addCallback(onSuccess, item) d.addErrback(log.err) deferreds.append(d)
Yes, that looks much cleaner.
Besides, you are adding the outer d to deferreds once per iteration. That's broken. I'm not sure what you mean here. I was adding my deferred to a list and it seemed to be doing what I wanted (at least I think it was).
Your original code had
d = doSomethingThatReturnsDeferred()
for item in list: d.addCallbacks(onSuccess, log.err) deferreds.append(d)
Which ends up adding the _same_ d len(list) times to deferreds.
Ahhh.... I see. That was a result of me rewriting my code for the post to this list, and not putting things in their original place. Thanks for your help.