[jdev] Python/XMPP GSoC proposal

Fabio Forno fabio.forno at gmail.com
Wed Mar 26 15:52:48 CDT 2008

On Wed, Mar 26, 2008 at 9:37 PM, Tro <troworld at gmail.com> wrote:
>  We tried to stay away from twisted, but not because we don't like it. We just
>  noticed that once you start using twisted, you end up using *lots* of it; we
>  wanted to keep the list of dependencies relatively small.

This is not necessary bad... In twisted usually you stay in twisted in
anything related to IO, i.e. anything potentially blocking, while for
teh rest you are able to use any library you want. The reason of this
is simple: since Twisted is event based with just one reactor
scheduling operations, you must delegate all I/O to twisted low level
functions, in order not to run the risk of remaining blocked

> Also, I did not see
>  an easy way to run callbacks in a thread and have the other callbacks wait
>  for it to finish. Maybe I didn't look hard enough, though.

First if you are using threads there are good chances you are using
twisted in the wrong way. Second, in the extremely few cases you may
need a thread (it's not clear what you want to do):
from twisted.internet import threads
d = threads.deferToThread(myfunc, args)

(now we're going off topic, if you are interested you may ping via jabber)

Fabio Forno, Ph.D.
Bluendo srl http://www.bluendo.com
jabber id: ff at jabber.bluendo.com

More information about the JDev mailing list