[Python-Dev] Conclusion: Event loops, PyOS_InputHook, and Tkinter

Michiel Jan Laurens de Hoon mdehoon at c2b2.columbia.edu
Wed Nov 16 02:34:02 CET 2005


Phillip J. Eby wrote:

> At 06:48 PM 11/15/2005 -0500, Michiel Jan Laurens de Hoon wrote:
>
>> Thanks everybody for contributing to this discussion. I didn't expect it
>> to become this extensive.
>> I think that by now, everybody has had their chance to voice their 
>> opinion.
>> It seems safe to conclude that there is no consensus on this topic.
>
>
> Just a question: did you ever try using IPython, and confirm whether 
> it does or does not address the issue you were having?  As far as I 
> could tell, you never confirmed or denied that point.
>
Yes I did try IPython.

First of all, IPython, being pure Python code, does not affect the 
underlying Python's loop (at the C level). So just running Python 
through IPython does not fix our event loop problem. On Windows, for 
example, after importing IPython into IDLE (which most of our users will 
want to use), our graphics window still freezes.

This leaves us with the possibility of using IPython's event loop, which 
it runs on top of regular Python. But if we use that, we'd either have 
to convince all our users to switch to IPython (which is impossible) or 
we have to maintain two mechanisms to hook our extension module into the 
event loop: one for Python and one for IPython.

There are several other reasons why the alternative solutions that came 
up in this discussion are more attractive than IPython:
1) AFAICT, IPython is not intended to work with IDLE.
2) I didn't get the impression that the IPython developers understand 
why and how their event loop works very well (which made it hard to 
respond to their posts). I am primarily interested in understanding the 
problem first and then come up with a suitable mechanism for events. 
Without such understanding, IPython's event loop smells too much like a 
hack.
3) IPython adds another layer on top of Python. For IPython's purpose, 
that's fine. But if we're just interested in event loops, I think it is 
hard to argue that another layer is absolutely necessary. So rather than 
setting up an event loop in a layer on top of Python, I'd prefer to find 
a solution within the context of Python itself (be it threads, an event 
loop, or PyOS_InputHook).
4) Call me a sentimental fool, but I just happen to like regular Python.

My apologies in advance to the IPython developers if I misunderstood how 
it works.

--Michiel.


-- 
Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1150 St Nicholas Avenue
New York, NY 10032




More information about the Python-Dev mailing list