[Python-Dev] Twisted Isn't Specific (was Re: Trial balloon: microthreads library in stdlib)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 15 01:31:19 CET 2007


glyph at divmod.com wrote:
> On 08:52 pm, theller at ctypes.org wrote:
> 
>  >When I last looked at twisted (that is several years ago), there were
>  >several reactors - win32reactor, wxreactor, maybe even more.
> 
> Only the very top-most level decides which reactor the application will use.

This is a worry, because it implies that there has to
*be* a top level that knows what kind of reactor the
whole application will use, and all parts of the
application need to know that they will be getting
their reactor from that top level.

That may not be the case. For example, you want to
incorporate some piece of event-driven code written
by someone else into your gtk application. But it
wasn't written with gtk in mind, so it doesn't know
to use a gtkreactor, or how to get a reactor that it
can use from your application.

This is not my idea of what another poster called a
"one-stop shop" -- a common API that different pieces
of code can call independently without having to know
about each other.

To my mind, there shouldn't be a "reactor" object
exposed to the application at all. There should just
be functions for setting up callbacks. The choice of
implementation should be made somewhere deep inside
the library, based on what platform is being used.

So at this point I'm skeptical that the Twisted
API for these things should be adopted as-is.

--
Greg


More information about the Python-Dev mailing list