Ihor Radchenko <yanta...@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 via email to