[Twisted-Python] A small patch for defer.py
User Paolino
paolo_veronelli at yahoo.it
Wed Apr 20 11:06:05 MDT 2005
Jp Calderone wrote:
> On Sat, 16 Apr 2005 18:50:02 +0000, User Paolino
> <paolo_veronelli at yahoo.it> wrote:
>
>> def deferredReady(value=False,later=0):
>> deferred=Deferred()
>> reactor.callLater(later,deferred.callback,value)
>> return deferred
>>
>> def generatorLoop(generator,listOfParams,multi=False):
>> lista=[]
>> for params in listOfParams:
>> if multi:
>> lista.append(deferredGenerator(generator)(*params))
>> else:
>> lista.append(deferredGenerator(generator)(params)) return
>> DeferredList(lista)
>>
>
> What? Also, why?
deferredReady is just missing in the library ,it's useful to let other
code execute in situations where calling functions are gready, like
resolving recursive query.
the second I use it everywhere where the cycles of a loop can be
executed in parallel as they are independent.
But I see, small things are not interesting ...
np
More information about the Twisted-Python
mailing list