emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: William Henney <whenney@gmail.com>
To: Karl Voit <news1142@karl-voit.at>
Cc: emacs-org <emacs-orgmode@gnu.org>
Subject: Re: Mixing Python2 and Python3 blocks in one file
Date: Tue, 17 May 2016 20:19:04 -0500	[thread overview]
Message-ID: <CAKchnZNra2jvy=ta9OofeWp2V5sUwLm0oy2fHb2BUp5AdEYPpQ@mail.gmail.com> (raw)
In-Reply-To: <2016-05-17T16-45-38@devnull.Karl-Voit.at>

[-- Attachment #1: Type: text/plain, Size: 2836 bytes --]

Hi Karl

On Tue, May 17, 2016 at 9:54 AM, Karl Voit <devnull@karl-voit.at> wrote:

> Hi William
>
> * William Henney <whenney@gmail.com> wrote:
> >
> > On Sun, May 8, 2016 at 3:31 AM, Karl Voit <devnull@karl-voit.at> wrote:
> >
> > Python2 and Python3 are two different languages. Unfortunately,
> >> Org-mode only uses ~#+BEGIN_SRC python~ for both and uses
> >> python-shell-interpreter to choose/switch the compiler.
> >>
> >> Shouldn't Org-mode introduce ~#+BEGIN_SRC python2~ and ~#+BEGIN_SRC
> >> python3~ to solve this issue in a clean way?
> >>
> >> ~#+BEGIN_SRC python~ can still default to python2.
> >>
> > You can use the :python header argument to the source block, which allows
> > you to specify the path to the python interpreter:
> >
> > #+BEGIN_SRC python :python /Users/will/anaconda/envs/py27/bin/python
>
> Cool, I did not find this parameter yet.
>
> Is this undocumented? http://orgmode.org/org.html does not contain
> the string ":python:" and
> http://orgmode.org/org.html#Language_002dspecific-header-arguments
> also does not mention this parameter.
>
>
It is documented at
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html

You are right that it would be better if the language-specific babel
documentation were better integrated in the general org info file.  But I
suppose nobody has been sufficiently motivated to do it yet


> > Also see original discussion at
> > https://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg01042.html
>
> Most interesting to me, thank you.
>
> With the parameter above as a workaround, I can accomplish the
> things I want to do for now. However, I still do think that Python2
> and Python3 as different languages demand different block
> identifiers.
>
> #+BEGIN_SRC python -> defaults to the default python interpreter
> #+BEGIN_SRC python2 -> uses Python2
> #+BEGIN_SRC python3 -> uses Python3
>
> Don't you think?
>
>
To be honest, I disagree that we need different block identifiers.  Python
is hardly the only language to have gone through multiple major versions,
and I don’t think a proliferation of org-babel languages is the answer.
What about C11 vs C99, etc?  I guess a good rule of thumb would be: do the
two versions use the same major mode in emacs?

Why is the :python parameter insufficient for your needs?  You can also use
it for different virtual environments

Cheers

Will



> --
> mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
>        > get Memacs from https://github.com/novoid/Memacs <
>
> https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on
> github
>
>
>


-- 

  Dr William Henney, Instituto de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

[-- Attachment #2: Type: text/html, Size: 4844 bytes --]

  parent reply	other threads:[~2016-05-18  1:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-08  8:31 Mixing Python2 and Python3 blocks in one file Karl Voit
2016-05-08 15:13 ` Karl Voit
2016-05-17 14:24 ` William Henney
2016-05-17 14:54   ` Karl Voit
2016-05-17 15:37     ` John Kitchin
2016-05-18  1:19     ` William Henney [this message]
2016-05-18  3:42       ` Thomas S. Dye
2016-05-18  7:11         ` Karl Voit
2016-05-18  7:10       ` Division of Org documentation: Org manual and Worg (was: Mixing Python2 and Python3 blocks in one file) Karl Voit
2016-05-18  8:10         ` Division of Org documentation: Org manual and Worg Daniele Pizzolli
2016-05-18  9:03           ` Rasmus
2016-05-18 10:08             ` Daniele Pizzolli
2016-05-18 10:18               ` Rasmus
2016-05-20 17:15                 ` Daniele Pizzolli
2016-05-20 18:46                   ` Rasmus
2016-05-18 10:18               ` Daniele Pizzolli
2016-05-18 13:45       ` Mixing Python2 and Python3 blocks in one file Ken Mankoff
2016-05-19  3:37         ` William Henney
2016-05-19 13:18           ` Ken Mankoff
2016-05-19 19:21             ` William Henney
2016-05-19 19:32               ` Ken Mankoff
2016-05-19 20:01                 ` William Henney

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='CAKchnZNra2jvy=ta9OofeWp2V5sUwLm0oy2fHb2BUp5AdEYPpQ@mail.gmail.com' \
    --to=whenney@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=news1142@karl-voit.at \
    /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).