[IPython-dev] IPython inputhook, higher rate?

Thomas Kluyver takowl at gmail.com
Thu Sep 25 12:20:39 EDT 2014


On 25 September 2014 08:17, Erik Bray <erik.m.bray at gmail.com> wrote:

> In short, it basically sets up its own select() loop that processing
> TCL events (each followed by a sleep, adjustable by
> _tkinter.setbusywaitinterval --the default is 20 ms) which runs until
> input is ready on stdin (at which point it returns control to Python).
> This is separate from the normal main event loop in that it *can*
> return control without quitting.
>

Yep - as Erik points out, several of our own input hooks do this: instead
of relying on Python polling PyOS_InputHook, they seize control and keep
running their own event loop until there's data ready on stdin, then return
control to Python. We provide a stdin_ready() function to facilitate this.

I've actually just written some documentation for integrating event loops
with IPython. You can see it here:
http://ipython.org/ipython-doc/dev/config/eventloops.html

Some of the APIs it describes are new in master, but the way that event
loop integration works hasn't changed.

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140925/31ce67dc/attachment.html>


More information about the IPython-dev mailing list