[Twisted-Python] Asynchronous context in Twisted

Glyph Lefkowitz glyph at twistedmatrix.com
Thu Mar 3 14:39:37 EST 2011

On Mar 3, 2011, at 7:31 AM, Fantix King wrote:

> Hi,
> I tried to make python.context work in asynchronous code between main loops. Anyone has similar experience to share please?
> Not sure if I am rebuilding a wheel :P
> http://code.google.com/p/little-site/source/browse/littlesite/custom_reactor.py

This is something I've often thought about doing in Twisted itself, actually :).  But I wasn't sure that chaining context would actually do anything practically useful most of the time.  Have you found that it's actually useful?  Have you managed to leverage this to, for example, get more informative error messages out of Deferred failures?

Doing it as a subclass like this is not optimal, as it limits you to one reactor (and the Select reactor is not really the best one).  A wrapper would be slightly more tricky (you'd have to deal with the places that the reactor passes itself through to things like Process and Port, so you'd have to create wrappers for those as well) but much more general.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110303/c578cf0d/attachment.htm 

More information about the Twisted-Python mailing list