[Python-Dev] Synchronous and Asynchronous servers in the standard library

Josiah Carlson jcarlson at uci.edu
Sun Nov 7 22:37:10 CET 2004


Bob Ippolito <bob at redivi.com> wrote:
> That's not really practical.  You can't use synchronous protocol code 
> in an asynchronous server without threads or Stackless... so what's the 
> point?  As for asynchronous frameworks that are compatible with the 
> Python license, I'm only aware of asyncore (which people generally feel 
> should be deprecated) and Twisted.

At least in the standard library right now, there is really one major
difference between sync and async servers; how data gets to and from
functions that implement the logic.


> I think the best course of action would be to create some stripped down 
> derivative of Twisted.  A couple changes off the top of my head would 
> make it more suitable for the standard library:
> 
> -  Allow generators to be easily used for asynchrony (much easier to 
> write synchronous-like code in that style, this has been demonstrated 
> by several people)
> -  Throw a blocking API on top because some people will want to use it 
> in a blocking manner (Twisted's testing framework already has this 
> functionality)
> -  Allow more than one reactor per process (necessary to support the 
> previous, because invariably people will use the blocking API from 
> several threads)
> -  Bring in some of the standard protocols (SMTP, HTTP, ...)  but not 
> the higher-level versions when available (twisted.web) because those 
> are so much more volatile.

This all sounds reasonable to me, though I am certain that I am not the
right man for doing such a conversion.

 - Josiah



More information about the Python-Dev mailing list