[Top][All Lists]

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

Re: [O] Babel python question: use of ipython and %cpaste

From: Rasmus
Subject: Re: [O] Babel python question: use of ipython and %cpaste
Date: Tue, 03 Dec 2013 12:44:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Arun Persaud <address@hidden> writes:

> Hi
> being able to use python as a source block is great, but I often stumble
> over the fact that when using sessions you have to treat empty lines in
> a special way (i.e. as the end of an indentation block).
> I was wondering if it would be easy to create an ipython mode, something
> like
> #+BEGIN_SRC ipython ...

You can get some of the way already.  Personally, I don't see the need
of a ipython block as I see IPython as an interpreter.

> where the content for a session is copied over to an ipython buffer
> using the ipython magic %cpaste. This way empty lines should be treated
> correctly.
> It would also have the nice side effect of giving access to other magic
> commands within org-babel, such as %timeit or profiling.

You could still use python source blocks for this.

For python.el I use :

  (setq python-shell-interpreter "ipython"
        ;; org mode seems to work better with classic mode. . .
        python-shell-interpreter-args "--classic --no-banner"
        "from IPython.core.completerlib import module_completion"

For Org you could do: 

  (setq org-babel-python-command "ipython --no-banner --classic 

You should now be able to do

#+BEGIN_SRC python :results output
%timeit 1+1

: >>> 10000000 loops, best of 3: 31.5 ns per loop
: >>> 



reply via email to

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