How to write an API for a Python application?

Alex Martelli aleax at mail.comcast.net
Sun Nov 20 03:44:35 CET 2005


Cameron Laird <claird at lairds.us> wrote:

> In article <cf0v43-le9.ln1 at lairds.us>, I mumbled:
>                       .
>                       .
>                       .
> >Pyro might be perfect.  My own instinct is to start even more
> >primitively, with a minimal asynchat client and server.  I've
> >looked through the *Cookbook*, and see that it doesn't have
> >what I want.  Maybe it's time Phaseit donate one of the
> >little models we use ...  
> 
> Ah-ha!  See Example 19-7, on page 447 of *Python in a Nutshell*:
> under two dozen lines that provide an echo server which correctly
> handles multiple concurrent clients.  

Note also that you can freely download all of the code in my book as
http://examples.oreilly.com/pythonian/pythonian-examples.zip (it's just
36 KB).  In that same chapter you will find several implementations of
mutually compatible clients and servers for that same echo-oid
"protocol" (as well as one incompatible one using UDP -- all the others
use TCP).  I hope they can be useful to anybody wanting to kludge
together some simple TCP/IP thingy (though, for the problem being
discussed in this thread, I'd rather recommend Corba;-).


Alex



More information about the Python-list mailing list