[Python-Dev] epoll() and kqueue wrapper for the select module

Ross Cohen rcohen at snurgle.org
Thu Dec 20 19:39:26 CET 2007

On Thu, Dec 20, 2007 at 06:08:47PM +0100, Christian Heimes wrote:

> I've written wrappers for both mechanisms. Both wrappers are inspired
> from Twisted and select.poll()'s API. The interface is more Pythonic
> than the available wrappers and it reduced the burden on the user. The
> users don't have to deal with low level control file descriptors and the
> fd is closed automatically when the object is collected.

Did you look at the python-epoll module which has been in the Cheese
Shop for quite some time? There is no messing with a low level control
file descriptor and it presents an identical interface to select.poll().

I would claim this whole new interface:

> epoll interface
> >>> ep = select.epoll(1)
> >>> ep.register(fd, select.EPOLL_IN | select.EPOLL_OUT)
> >>> ep.modify(fd, select.EPOLL_OUT)
> >>> events = ep.wait(1, 1000)
> >>> ep.unregister(fd)

Is a greater burden on the user than:

>>> import epoll as select

I would also claim that adding a new interface to accomplish the same
task is not more pythonic. But I did write the python-epoll module in
question, so I may be a bit biased.


More information about the Python-Dev mailing list