[IPython-dev] Execution semantics and how to set them

Zakariyya Mughal zaki.mughal at gmail.com
Sun Jan 25 13:26:42 EST 2015


Hello,

I'm a language kernel author  and I'm looking at the execution semantics
document[^1] where I see a reference to the "single" execution mode.

It says that the code
 
    for i in range(10):
        i**2
 
running in "single" mode would display 10 lines.

I looked through the IPython source and I see that the execution
semantics are set as an argument for `run_ast_nodes`[^2], but I see no
way that the given for-loop would give multiple outputs unless the
`interactivity` parameter is set to `last` or `all`.

Is there a way to activate this execution mode through a front-end and
pass that information to the back-end using the messaging protocol?

Or should I just implement the logic at the end of the document ("The
code field is split into individual blocks...") in my language back-end?

Cheers,
- Zaki Mughal

[^1]: Execution semantics spec <http://ipython.org/ipython-doc/dev/development/execution.html#execution-semantics>

[^2]: run_ast_nodes() <https://github.com/ipython/ipython/blob/d0fbe137/IPython/core/interactiveshell.py#L2919>



More information about the IPython-dev mailing list