[Python-Dev] epoll implementation
Ross Cohen
rcohen at snurgle.org
Fri May 26 21:19:42 CEST 2006
On Fri, May 26, 2006 at 08:48:42PM +0200, "Martin v. Löwis" wrote:
> Ross Cohen wrote:
> > I agree that it should go into the select module, but not as a seperate
> > set of calls. epoll is strictly better than poll. kqueue is strictly
> > better than poll. Windows has its own completion ports API. Why should
> > an application developer have to detect what platform they are running on?
>
> Because the APIs have different semantics. Design some API for epoll,
> and make it replace select or poll (your choice), and I create you
> an application that breaks under your poll "emulation".
It doesn't emulate the poll system call, it implements the poll call from
the select module. See below.
> If a complete emulation was possible, the OS developers would not have
> invented a new API.
True, and as I mentioned before, the python API more closely matches epoll
in this case. The level-triggered mode of epoll is an almost perfect match.
Someone went to some lengths to hide the details of the system poll
interface.
> > Why not simply provide the best implementation for the platform through the
> > python API everyone is already using?
>
> Well, what *is* the API everyone is already using? This is really
> something for a higher-level API that assumes a certain processing
> model (unless the OS API, which assumes no processing model).
Without resorting to extension modules which are not part of the standard
python library, people are using either select.poll or select.select. I
was referring to select.poll, which is a better interface, but I believe
isn't available on OS X.
> Python has a tradition of exposing system APIs *as is*, with no
> second-guessing either the OS developers, nor the application
> developers. Then, we put a unified API *on top* of that. For
> event processing, the standard library always provided
> asyncore/asynchat, although people don't like it.
Someone already broke that tradition in this case. If the select.poll
implementation is improved then everyone reaps the benefit.
Ross
More information about the Python-Dev
mailing list