On 15/09/05, Michael Sparks <[EMAIL PROTECTED]> wrote:
> At the moment, one option that springs to mind is this:
> yield WaitDataAvailable("inbox")
Twisted supports this.
help("twisted.internet.defer.waitForDeferred")
example usage is:
@deferredGenerator
def thingummy():
thing = waitForDeferred(makeSomeRequestResultingInDeferred())
yield thing
thing = thing.getResult()
print thing #the result! hoorj!
With the new generator syntax, it becomes somewhat less clunky,
allowing for the syntax:
@defgen
def foo():
somereturnvalue = yield SomeLongRunningOperation()
print somereturnvalue
http://svn.twistedmatrix.com/cvs/sandbox/radix/newdefgen.py?view=markup&rev=14348
--
Stephen Thorne
Development Engineer
--
http://mail.python.org/mailman/listinfo/python-list