Deferred
s are a great way to do asynchronous processing in Twisted. However, they, like the name implies, are for deferred computations, which only run and terminate once, firing the callbacks once. What if I have a repeated computation, like a button being clicked? Is there any Deferred
-like object that can fire repeatedly, calling all callbacks attached to it whenever it is fired?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
I've set this up for now. For my limited use case it does what I want.
Someone let me know if this is terrible.
What you might be looking for is
defer.inlineCallbacks
which allows you to use a generator to create a sequential chain of Deferreds. Essentially you could just create a generator that never ends (or ends conditionally) and keep generating Deferreds from that.There is a great writeup on using
inlineCallbacks
at krondo.com.