[Python-Dev] A replacement for asyncore / asynchat

Panu A Kalliokoski atehwa@iki.fi
Mon, 16 Jul 2001 12:52:30 +0300 (EET DST)

Hello all, I've developed a Python module (in Python) to make somewhat
higher abstraction over select.select(). The package is called
"Selecting".  The package is somewhat similar to asyncore, but has many
advantages over it:

- It's made in OO fashion, allowing for greater flexibility in
  overriding default behaviour;
- Event queues, which allow you to schedule events that should happen
  sometime in the future (nicely synced with select()) (permanent /
  one-shot events);
- Cleaner API;
- Channel interfaces. It's possible to make many different channels as
  long as they have a fd to select() on; with this, you can implement,
  for example, inter-thread locking with pipes.
- Simpler buffering scheme, which makes it unnecessary to use unblocking
  fd's, and might even give some speed;
- No exception handling (I found exception packing of asyncore to be a
  real nuisance)
- Clearer (?) division of responsibility: the API of channel handlers,
  etc.  (asyncore puts part of message handling into the socket wrapper)

For these reasons, I think that the asyncore package in the Python main
distribution should be replaced with Selecting or at least Selecting
should be put in the main distribution.

The package is available at
http://sange.fi/~atehwa-u/selecting/		(for browsing)  and
http://sange.fi/~atehwa-u/selecting-0.89.tar.gz (for downloading).

The package is quite well tested and has been used to build ircd-style
daemons, but more testing and comments are always welcome.

Panu Kalliokoski