I have been trying to use the :session feature of babel for python code blocks. I have noticed a few things that might be areas for improvement. Some issues are related to what I think might be a need for sanitizing the code blocks and the output.
I am using (insert (org-version)) 7.9.3a I am using python-mode 5.2 (more modern versions do not work with :session for me)
The first small detail is illustrated here:
#+BEGIN_SRC python :session
a = 5
b = 6
print a + b #+END_SRC
#+RESULTS: : : >>> >>> >>> 11
In the output, there are three sets of >>>, due to the two empty lines. Compare this to
#+BEGIN_SRC python :session a = 5 b = 6 print a + b #+END_SRC
#+RESULTS: : : >>> 11
I think it would be nice to sanitize the python code block sent to the interpreter to eliminate the empty lines, and avoid the multiple >>> in
output. It would also be nice to have an option to not print those at all.
The second issue is related. The following code does not work for me in :session, but it works fine as a standalone block. The issue is related
to the presence of an empty line in the function definition. I like whitespace like this in functions sometimes for readability.
I think if there was a way to strip all the empty lines from the input,
it would go a long way to making the output look like what I think most people would expect and want.
Anyway, those are the examples I wanted to highlight in this post.
1. Do you see similar behavior, or is this a feature of my setup?
2. Is there any interest in sanitizing the input and output of a python :session to get prettier output? if so, Any hints on where to start with that?
Thanks,
John
-----------------------------------
John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu