[Twisted-Python] Using DeferredList with deferredGenerator or inlineCallbacks?

Don Dwiggins ddwiggins at advpubtech.com
Fri Apr 11 19:37:40 EDT 2008

I have some code that uses defer.deferredGenerator (Python 2.4) like so:

>         info1InProgress = defer.waitForDeferred(self.info1Deferred(acctNo))
>         yield info1InProgress
>         info2InProgress = defer.waitForDeferred(self.info2Deferred(acctNo))
>         yield info2InProgress
>         # Both queries have results; process them
>         info1Result = info1InProgress.getResult()
>         info2Result = info2InProgress.getResult()

The "info" functions are two queries using adbapi whose results will be 
combined in subsequent code; they're independent, in that either could 
be run before the other.  My question is, could I use a DeferredList 
somehow in this case, without giving up the convenience of the inline 
style?  If so, could it also be done in 2.5 using inlineCallbacks?

Don Dwiggins
Advanced Publishing Technology

More information about the Twisted-Python mailing list