jupyter
jupyter copied to clipboard
Multiple results mode?
Thanks for your work on this package.
Is it possible to capture results from each statement/line in the source block? For instance, the below returns : world currently, but can it be made to return
: hello
: world
?
:PROPERTIES:
:header-args: :session test :kernel python :results raw drawer replace
:END:
#+begin_src jupyter-python
"hello"
"world"
#+end_src
#+RESULTS:
: world
The IPython equivalent is
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
If you don't mind calling display on each line you want shown, you get the desired result.
#+begin_src jupyter-python
display("hello")
display("world")
#+end_src
#+RESULTS:
:RESULTS:
: hello
: world
:END:
Thanks!
I think this (multiple results without display()) would be a useful feature to have; in my experience I use that IPython snippet in every notebook, and it is nice not to have to remember to wrap everything in display().
Oh, I see - sorry if I stated the obvious then. It took me some time to figure out that you could call display a bunch of times to get multiple outputs. In the Jupyter notebook it is ergonomic to have each statement on a separate cell, but not as much form within org mode due to the boilerplate. Could be nice to have something like :results verbose to get an output for each line.