emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [babel] python sessions


From: Andrea Crotti
Subject: [O] [babel] python sessions
Date: Sun, 03 Jul 2011 14:18:42 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

I wanted to use sessions in python to do some nice literate programming
and splitting functions, but it doesn't work as expected.

Here below a very simple example in python and ruby, where in ruby
everything seems to work well while in python it doesn't...
And by the way, what is that org_babel_python_eoe? I can't find it
documented anywhere in the manual...

I've read some time ago that python support for babel was a bit tricky,
are there workarounds to make it work anyway?

Or could you explain briefly what the problem is so that I can try to
contribute as soon as I finish this thing?

Thanks a lot,
Andrea

--8<---------------cut here---------------start------------->8---
#+begin_src python :session
  def var(x):
      return float(x ** 2)
  
#+end_src

#+results:
: org_babel_python_eoe

#+begin_src python :session
  def var2(x):
      return x ** 2 * var(x)
  
  var2(10)
#+end_src

#+results:
: org_babel_python_eoe

#+begin_src ruby :session
  def fun(x)
    x + 2
  end
#+end_src

#+results:
: nil

#+begin_src ruby :session
  def fun2(x)
    x + fun(x)
  end
  
  fun2 10
#+end_src

#+results:
: 22

--8<---------------cut here---------------end--------------->8---



reply via email to

[Prev in Thread] Current Thread [Next in Thread]