id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	keywords	cc	branch	branch_author	launchpad_bug
4919	Replace flawed DeferredList(..., fireOnOneCallback=True) with something better	spiv		"DeferredList's `fireOnOneCallback` option has a big defect: if all of the deferreds fail, you get a callback with a list of 2-tuples of `(False, <failure>)` that is hard to distinguish from the callback you'd get if one of the deferreds succeeded.  Consider the edge cases of a list of 2 deferreds: either way you get a sequence of length 2.  You'd probably need to rely on implementation details like one case returns a tuple and the other a list!

Perhaps fireOnOneCallback should be deprecated and replaced with an API more like gather results.  Off the top of my head:

{{{
def firstSuccess(listOfDeferreds, consumeErrors=True):
    """"""Return the first success from listOfDeferreds.

    If all the deferred fail, it will errback with an AllFailedError containing all the failures.

    @param consumeErrors: like DeferredList.
    """"""
}}}

''Perhaps'' this should also provide the index of the result if successful?  Or maybe do so optionally?

(DeferredList in general also has the flaw that's simply a bit cumbersome to use, because it returns such an unwieldy result... this may be a step towards remedying that by replacing it.)

This idea was prompted by a conversation on IRC with detly."	enhancement	new	normal		core						
