[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 04:18:40 CET 2007


Thomas Wouters wrote:

> If the choice for 
> reactor was made somewhere deep inside the library, how does it know to 
> use the GTK reactor?

In my ideal world, there wouldn't actually be a gtk
reactor -- there would only be a Linux reactor, a
MacOSX reactor, a Windows reactor, etc. Things like
pygtk would be adapted to hook into the platform's
standard reactor.

Less ideal would be for pygtk to intall a gtk reactor
when it gets imported. The danger with this approach
is that two libraries could fight over which kind
of reactor to use.

You suggest that the top level could choose some other
reactor that is compatible with both libraries. That
seems like a rather hit-and-miss approach -- such a
reactor might exist, or it might not. If not, you're
out of luck. And the chance of finding a suitable
reactor gets smaller as the number of libraries
increases.

> The reason the decision should be made at the topmost level is that this 
> is the most visible and adaptive location.

This is where my vision is fundamentally different:
you shouldn't have to *make* a decision in the first
place. All event-driven libraries should be made to
use the same substrate on any given platform. Then
they can coexist without the need for any top-level
choices.

I know that will be hard to do, but it's the only
way out of this mess that I can see.

--
Greg


More information about the Python-Dev mailing list