emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andrea Crotti <andrea.crotti.0@gmail.com>
To: Org mode <emacs-orgmode@gnu.org>
Subject: [babel] python sessions
Date: Sun, 03 Jul 2011 14:18:42 +0200	[thread overview]
Message-ID: <sa04o33o8v1.fsf@gmail.com> (raw)

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	other threads:[~2011-07-03 12:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-03 12:18 Andrea Crotti [this message]
2011-07-03 15:15 ` [babel] python sessions Eric Schulte
2011-07-03 16:51   ` Andrea Crotti
2011-07-03 18:13     ` Eric Schulte
2011-07-03 18:54       ` Andrea Crotti
2011-07-04 17:23         ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sa04o33o8v1.fsf@gmail.com \
    --to=andrea.crotti.0@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).