Matthias Bussonnier <bussonniermatth...@gmail.com> added the comment:

> I think the first thing is to add async "modes" to compile: in particular 
> "async-exec" and "async-single". These would be like the current "exec" and 
> "single" modes respectively, except that they act like the code is inside an 
> "async def", so "await" is allowed, and executing the resulting code object 
> produces a coroutine object that has to be iterated to actually run the code.

> This seems like a separate problem from the async stuff... I'm curious to 
> hear how what distinction you want to make between 'exec' and a new 
> 'multi-single' (?) mode, but maybe that should be a new issue?

Mell, in classical `exec` there is always a tension between "this is for a 
module" and "this is for REPL". We saw that close to 3.7 release where strings 
literal were moved into the AST Module `docstring` attribute.

In IPython[1] we also have to dance to trigger the display hook in a multi-line 
context by executing each top-level node one by one. So while we are designing 
a new `async-exec` while not tackle that issue at the same time and cover both 
use case ? That should let one category of user do the optimization they wish 
and get a `Module` object, without being slow down by the other. 

1: 
https://github.com/ipython/ipython/blob/869480ed70944ca70ad9ed70779b9c3e4320adb7/IPython/core/interactiveshell.py#L3179-L3190

----------

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

Reply via email to