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

glyph at divmod.com glyph at divmod.com
Wed Feb 14 23:55:31 CET 2007


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.

Yes.  That's intentional.  Each of those systems offers its own event loop, and each reactor implements the basic operations in terms of those loops.

They all have the same API.  Application code does 'from twisted.internet import reactor; reactor.listenTCP', 'reactor.callLater', etc.  Only the very top-most level decides which reactor the application will use.

>And they
>didn't even work too well.  The problems I remember were that the win32reactor
>was limited to a only handful of handles, the wxreactor didn't process
>events when a wx modal dialog boy was displayed, and so on.  Has this changed?

win32eventreactor is limited to 64 handles because WaitForMultipleObjects is limited to 64 handles.  wxreactor's event loop is ghastly and actually did pause when a modal dialog box is displayed (that has since been fixed).  Process support on win32 now works in the default select reactor as well as the gtk reactor, so win32reactor is mostly a curiosity at this point (useful mainly if you want to implement your own GDI-based GUI, as PyUI did at one point), and its limitations are not as serious for Twisted as a whole.

In other words, Twisted exposes the platform limitations in its platform-specific event loop implementations, and only works around them where it's possible to do so without masking platform functionality.

For servers, the epoll, poll, and select reactors work just fine.  The select reactor does have a maximum of FD_SETSIZE simultaneous sockets as well, but it is very easy to switch reactors if you need something more scalable.

For clients, the best GUI toolkit for Twisted applications at this point is GTK, but WX, QT and Cocoa can all be made to work with a minimum of hassle.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20070214/70e146d7/attachment.htm 


More information about the Python-Dev mailing list