[Python-ideas] Yielding from the command line
Guido van Rossum
guido at python.org
Fri Sep 12 17:01:35 CEST 2014
While it may be possible to build "yield from" into a custom
read-eval-print loop (REPL), that's tricky because the built-in REPL in
written in C. the quickest way to success is definitely the helper function
shown in the first response.
On Fri, Sep 12, 2014 at 12:33 AM, Martin Teichmann <lkb.teichmann at gmail.com>
wrote:
> Hi Terry, Hi List,
>
> > I presume full behavior requires the call to root.mainloop(). This has
> two
> > problems for continued interaction. First, the call blocks until the
> window
> > is closed, making further entry impossible through normal means. If that
> > were solved with a 'noblock' option, there would still be the problem of
> > getting shell input to a callback that could, on demand, execute to code
> to
> > modify the tk app. The solution would have to be different for the
> console
> > interpreter, there tkinter is running in the same process and Idle, where
> > tkinter is running is a separate process.
>
> You just gave a good reasoning for the advantages of asyncio. Because once
> we have an asyncio-aware version of tkinter - and an asyncio-aware command
> line, this is what I am proposing - all the problems you just described
> disappear. So, I would call that a good use case for my idea.
>
> A tkinter-aware commandline would then just look like:
>
> set_event_loop(TKInterEventLoop())
> async(commandline()) # i.e. the coroutine defined in my last post
> get_event_loop().run_forever() # this calls root.mainloop()
>
> Greetings
>
> Martin
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140912/55d25fa2/attachment.html>
More information about the Python-ideas
mailing list