From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: emacs-orgmode@gnu.org
Cc: Gary Oberbrunner <garyo@oberbrunner.com>,
Eric Schulte <schulte.eric@gmail.com>
Subject: Re: Fwd: Fwd: run python from org, draft
Date: Fri, 29 Mar 2013 21:58:34 +0100 [thread overview]
Message-ID: <5156007A.6030003@easy-emacs.de> (raw)
In-Reply-To: <CAFChFyiWXyrUcTh67VoN-2WT_ssDcisJS4RRmMrfBShbi0qKzQ@mail.gmail.com>
Am 29.03.2013 21:10, schrieb Gary Oberbrunner:
> On Fri, Mar 29, 2013 at 11:29 AM, Andreas Röhler <
> andreas.roehler@easy-emacs.de> wrote:
>
>> IMO org-babel should be able to run source code as is.
>> If an org-mode specific modification is required at such a trivial form,
>> what to expect wrt complex environments?
>>
>> BTW this fails also:
>>
>> #+begin_src python
>> print "Hello, world!"
>> #+end_src python
>>
>> #+RESULTS:
>> : None
>>
>
> As the worg doc says, if you want to capture stdout rather than a value,
> you need :results output. The default is :results value (which in session
> mode is the last expression executed, and in non-session mode is whatever
> you return().)
>
> I agree it is a little odd, but given how python works it's not clear to me
> how to improve it.
Hi Gary,
if someone wants the value of the last expression returned, it's much simpler to write Python/native
language, than cryptic, lately documented org-mode flags.
That's a kind of re-inventing a programming-language, also redundant.
Specifically, in non-session mode, the python
> interpreter is run as a separate process and fed the input (with some stuff
> around it). There is no way for python to get "the last value" in
> non-interactive mode,
No? Any program may output any of it's values.
> so instead ob-python wraps your code in a function,
> then calls it, and writes the return value of that function to the temp
> file. Conversely in session mode, each block is talking to the same
> interactive python interpreter, just what you get if you type 'python' at
> the shell. So using return() there doesn't make any sense, and wouldn't
> work.
The use of "return" doesn't depend from interactive mode.
It's related to a function.
Seen from org-user, IMO any back-ends interactive mode or not is not of interest.
":session" mimics and/or probably uses it, but it would also possible to implement it as a file, loading
previous values from a storage.
I don't see any way to make them both behave the same way.
>
Probably most useful at this list is to define which feature/behavior is most convenient.
Why people use this mode, what they want to do.
Cheers,
Andreas
next prev parent reply other threads:[~2013-03-29 20:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 21:55 run python from org, draft Andreas Röhler
[not found] ` <CAFChFyjZyxcnH1_jSWEUgXNkvJ0c3F8f4ojQa_EtPov2TjtziQ@mail.gmail.com>
2013-03-29 12:11 ` Fwd: " Gary Oberbrunner
2013-03-29 14:47 ` Andreas Röhler
2013-03-29 14:57 ` John Hendy
2013-03-29 15:09 ` Eric Schulte
2013-03-29 15:29 ` Andreas Röhler
2013-03-29 16:20 ` Eric Schulte
2013-03-29 16:49 ` Andreas Röhler
2013-03-29 16:59 ` Eric Schulte
2013-03-29 18:33 ` Evan Misshula
2013-03-29 18:50 ` Eric Schulte
2013-03-29 19:04 ` Evan Misshula
[not found] ` <CAFChFyhRbz6hh-NyOZTfdKJcTPh=F3J=07k2fR9p+A9Wig_pRA@mail.gmail.com>
2013-03-29 20:10 ` Fwd: " Gary Oberbrunner
2013-03-29 20:58 ` Andreas Röhler [this message]
2013-03-31 20:04 ` Gary Oberbrunner
2013-03-29 15:35 ` John Hendy
[not found] ` <CAFChFyhOrPVS2E5CE9H2+zX5TFV4D-themQbjx2DaSx-WmG14g@mail.gmail.com>
2013-03-29 20:11 ` Fwd: " Gary Oberbrunner
2013-03-29 15:50 ` John Hendy
2013-03-29 16:23 ` Eric Schulte
2013-03-29 16:47 ` Eric Schulte
2013-03-29 19:06 ` Andreas Röhler
2013-03-29 20:04 ` Andreas Röhler
2013-03-29 19:59 ` Gary Oberbrunner
2013-03-29 20:15 ` Andreas Röhler
2013-03-29 20:25 ` Eric Schulte
2013-03-29 20:45 ` Gary Oberbrunner
2013-03-29 21:13 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5156007A.6030003@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--cc=emacs-orgmode@gnu.org \
--cc=garyo@oberbrunner.com \
--cc=schulte.eric@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.