[Python-ideas] The async API of the future

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Oct 21 01:41:41 CEST 2012


Richard Oudkerk wrote:
> I don't see why a completion api needs to create wrappers for sockets.  See
> 
>     http://pastebin.com/7tDmeYXz
> 
> ...
> 
> The AsyncIO class is independent of reactors, futures etc.  The methods 
> for starting an operation are
> 
>     recv(key, sock, nbytes, flags=0)
>     send(key, sock, buf, flags=0)
>     accept(key, sock)
>     connect(key, sock, address)

That looks awfully like a wrapper for a socket to me. All of those
system calls are peculiar to sockets.

There doesn't necessarily have to be a wrapper class for each kind
of file descriptor. There could be one I/O class that handles everything,
or there could just be a collection of functions.

The point is that, with a completion-based model, you need a function
or method for every possible system call that you might want to perform
asynchronously.

-- 
Greg



More information about the Python-ideas mailing list