emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jack Kamm <jackkamm@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: "Dr. Arne Babenhauserheide" <arne_bab@web.de>,
	"Rudolf Adamkovič" <rudolf@adamkovic.org>,
	emacs-orgmode@gnu.org
Subject: Re: Org Babel says 1 + 1 in Python is None
Date: Mon, 21 Oct 2024 19:43:49 -0700	[thread overview]
Message-ID: <871q08502i.fsf@gmail.com> (raw)
In-Reply-To: <877ca19vvv.fsf@localhost>

Ihor Radchenko <yantar92@posteo.net> writes:

>> I think it would be feasible to switch non-session blocks to use this
>> parser, which IMO is nicer behavior -- the "return" statements always
>> felt weird to me.
>>
>> But a major reason not to do it is to avoid breaking compatibility. Lots
>> of old ob-python nonsession blocks with "return" statements out there.
>
> May we detect if there is a return statement?

That's a nice idea, I like it.

Probably there should be a customization
`org-babel-python-nonsession-return-style', which could take on the
values 'require-return (old behavior), 'last-statement (session style),
or 'auto (detect if there is return statement).

While technically a breaking change, I think 'auto would be a reasonable
default, since it would only change the behavior on the unusual edge
case where the user deliberately returned "None" by omitting a return
statement.


  reply	other threads:[~2024-10-22  2:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 13:33 Org Babel says 1 + 1 in Python is None Rudolf Adamkovič
2024-09-07  8:12 ` Dr. Arne Babenhauserheide
2024-10-13 11:41   ` Ihor Radchenko
2024-10-20  7:08     ` Jack Kamm
2024-10-20  9:39       ` Ihor Radchenko
2024-10-21  6:00         ` Jack Kamm
2024-10-21 18:03           ` Ihor Radchenko
2024-10-22  2:43             ` Jack Kamm [this message]
2024-09-07  9:27 ` Sébastien Gendre

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=871q08502i.fsf@gmail.com \
    --to=jackkamm@gmail.com \
    --cc=arne_bab@web.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=rudolf@adamkovic.org \
    --cc=yantar92@posteo.net \
    /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).