Martin Teichmann added the comment:

well, I beg to differ. Again, to your points:

to a) You claim that my flag would have to be supported by every
python platform. Well, the very same built-in function has another
flag, PyCF_ONLY_AST, whose precise meaning, according to the docs,
"might change with each Python release". And I am not sure if
all your mentioned distributions (PyPy, Jython, IronPython, Cython)
will ever have an actually compatible support for PyCF_ONLY_AST.
While I think that it would be not too hard to support my GENERATOR
flag on those platforms (maybe except Cython).

to b) This is by far the most important part of my patch, something
like this certainly should go into CPython. I am actually of the
opinion that something like it is very important even without a)
getting accepted. I just looked at the event loop of IPython, what
they are doing there is just sheer horror: First they have to
cripple each event loop they support (be it Qt, GTK or WX) to
accept only some events at a time. Then they use ctypes (yes, 
ctypes: they cannot do it in Python!) to install this as a
hook to PyOS_InputHook, a function so undocumented even google
couldn't find docs (but many discussions where people had major
problems properly using it).

All of this would be solved with an input function which does not
block I/O. All the event loops (including the asyncio event loop)
would just install a callback on stdin and call my input once
they need to. I am certainly open to all kinds of proposals on how
it precisely should work, and sure bugs need to be fixed.

c) sure, with b) accepted c) is just trivial. It was a mere example
of the usage of b). b) was written under the principle "write as
much as you can in python, only the bare minimum in C" which I think
is a good idea given that it is so much nicer to program in Python than in C.

The fact that it would not work under Windows to me is actually
not a point, we would just have to make it run under Windows with
different means (unfortunately, I'm not such a Windows expert that
I would now which those means would be).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22412>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to