How to write an API for a Python application?

Cameron Laird claird at
Sun Nov 20 03:08:02 CET 2005

In article <cf0v43-le9.ln1 at>, 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.  

But that's also about as much as I've found publicly in that 
direction.  The original questioner wanted, or thought he wanted,
an object-capable protocol, so he could invoke methods remotely;
for that, I return to Paul Boddie's correct observation that 
folks can use CORBA, or imitate CORBA badly (as much of this
season's "SOA" does).  What I don't see, though, is a nice client-
server pair that are minimal, and exhibit *symmetric* event-oriented
performance and scalability.  Some people mistakenly regard this
"peering" architecture as a dark secret.  I think I'll write a model
in under fifty lines of Python this week ...

More information about the Python-list mailing list