A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20070215/d8aa6049/attachment.htm below:

<html><body><br />On 12:31 am, greg.ewing@canterbury.ac.nz wrote:<br />&gt;glyph@divmod.com wrote:<br />&gt;&gt; On 08:52 pm, theller@ctypes.org wrote:<br />&gt;&gt;<br />&gt;&gt; &#160;&gt;When I last looked at twisted (that is several years ago), there were<br />&gt;&gt; &#160;&gt;several reactors - win32reactor, wxreactor, maybe even more.<br />&gt;&gt;<br />&gt;&gt; Only the very top-most level decides which reactor the application will use.<br />&gt;<br />&gt;This is a worry, because it implies that there has to<br />&gt;*be* a top level that knows what kind of reactor the<br />&gt;whole application will use, and all parts of the<br />&gt;application need to know that they will be getting<br />&gt;their reactor from that top level.<br /><br />The default reactor is the most portable one, 'select', and if no other reactor &#160;is installed, that's the one that will be used.<br /><br />&gt;That may not be the case. For example, you want to<br />&gt;incorporate some piece of event-driven code written<br />&gt;by someone else into your gtk application. But it<br />&gt;wasn't written with gtk in mind, so it doesn't know<br />&gt;to use a gtkreactor, or how to get a reactor that it<br />&gt;can use from your application.<br /><br />"from twisted.internet import reactor" is the way you get at the reactor, regardless of which one is currently installed.<br /><br />There can only be one reactor active at any given time, because at the very bottom of the event-handling machinery _some_ platform multiplexing API must be called, and that is mostly what the reactor represents.<br /><br />The GTK reactor does not have its own API. &#160;It simply allows you to use GTK APIs as well, by back-ending to the glib mainloop. &#160;That is, in fact, the whole point of having a "reactor" API in the first place.<br /><br />&gt;This is not my idea of what another poster called a<br />&gt;"one-stop shop" -- a common API that different pieces<br />&gt;of code can call independently without having to know<br />&gt;about each other.<br /><br />&gt;To my mind, there shouldn't be a "reactor" object<br />&gt;exposed to the application at all. There should just<br />&gt;be functions for setting up callbacks.<br /><br />That's what the Twisted "reactor" object *is*, exactly. &#160;Functions (well, methods) for setting up callbacks.<br /><br />&gt;The choice of<br />&gt;implementation should be made somewhere deep inside<br />&gt;the library, based on what platform is being used.<br /><br />The "deep inside the library" decision is actually a policy decision made by a server's administrator, or dependent upon the GUI library being used if you need to interact with a GUI event loop. &#160;Perhaps the default selection could be better, but installing a reactor is literally one line of code, or a single command-line option to the "twistd" daemon. &#160;See:<br /><br />http://twistedmatrix.com/projects/core/documentation/howto/choosing-reactor.html<br /><br />It is completely transparent to the application, _unless_ the application wants to make use of platform-specific features.<br /><br />See the following for more information:<br /><br />http://www.cs.wustl.edu/~schmidt/PDF/reactor-siemens.pdf<br /><br />although technically Twisted's "reactor" is more like the slightly higher level POSA "proactor" pattern; asyncore is more like a true "reactor" in the sense discussed in that paper.<br /><br />Twisted exposes various APIs for "setting up callbacks" exactly as you describe:<br /><br />http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorTCP.html<br />http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorTime.html<br /><br />&gt;So at this point I'm skeptical that the Twisted<br />&gt;API for these things should be adopted as-is<br /><br />Given that your supporting arguments were almost exactly the opposite of the truth in every case, I think this conclusion should be re-examined :). &#160;If you're interested in how a normal Twisted application looks, see this tutorial:<br /><br />http://twistedmatrix.com/projects/core/documentation/howto/servers.html<br /></body></html>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4