<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>On Mar 3, 2011, at 7:31 AM, Fantix King wrote:</div><div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<div><br></div><div>I tried to make python.context work in asynchronous code between main loops. Anyone has similar experience to share please?</div><div><br></div><div>Not sure if I am rebuilding a wheel :P</div><div><br>

</div><div><a href="http://code.google.com/p/little-site/source/browse/littlesite/custom_reactor.py">http://code.google.com/p/little-site/source/browse/littlesite/custom_reactor.py</a></div>

</blockquote><br></div><div>This is something I've often thought about doing in Twisted itself, actually :). &nbsp;But I wasn't sure that chaining context would actually do anything practically useful most of the time. &nbsp;Have you found that it's actually useful? &nbsp;Have you managed to leverage this to, for example, get more informative error messages out of Deferred failures?</div><div><br></div><div>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). &nbsp;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.</div><div><br></div></body></html>