[Python-ideas] Add a generic async IO poller/reactor to select module

Ronald Oussoren ronaldoussoren at mac.com
Fri May 25 08:39:23 CEST 2012


On 24 May, 2012, at 20:40, Giampaolo Rodolà wrote:

> 2012/5/24 Nick Coghlan <ncoghlan at gmail.com>:
>> On Thu, May 24, 2012 at 10:37 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>> On Thu, May 24, 2012 at 9:50 PM, Giampaolo Rodolà <g.rodola at gmail.com> wrote:
>>>> poller.poll serves the same purpose of asyncore.loop, yes, but this is
>>>> supposed to be independent from asyncore.
>>> 
>>> I'd actually like to see something like this pitched as a
>>> "concurrent.eventloop" PEP. PEP 3153 really wasn't what I was
>>> expecting after the discussions at the PyCon US 2011 language summit -
>>> I was expecting "here's a common event loop all the async frameworks
>>> can hook into", but instead we got something a *lot* more ambitious
>>> taht tried to merge the entire IO stack for the async frameworks,
>>> rather than just provide a standard way for their event loops to
>>> cooperate.
>> 
>> See the final section of my notes here:
>> http://www.boredomandlaziness.org/2011/03/python-language-summit-rough-notes.html
>> 
>> Turns out the idea of a PEP 3153 level API *was* raised at the summit,
>> but I'd still like to see a competing PEP that targets the reactor
>> level API directly.
>> 
>> Cheers,
>> Nick.
> 
> 
> It's not clear to me what such a PEP should address in particular,
> anyway here's a bunch of semi-random ideas.


All of these are probably too low level to be the only API because they don't encapsulate error handling. 

A slightly higher level API would have a callback with received data and a buffered API for sending data. That way the networking library can deal with lowlevel socket API errors and translate them to usefull abtract errors. It would also handle some errors like and EGAIN error itself.

Also: how would you use SSL with these APIs? 

The API would probably end up with functionality simular to Twisted's reactor and transport APIs (and possibly endpoints but I don't know how stable that API is). 

Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4788 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120525/f2c67ccd/attachment.bin>


More information about the Python-ideas mailing list