[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, an
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots |
Date: |
Thu, 17 Aug 2023 11:57:05 +0000 |
Jack Kamm <jackkamm@gmail.com> writes:
> Following up on a discussion from last month [1], I am reviving my
> proposal from a couple years ago [2] to improve ob-python results
> handling. Since it's a relatively large change, I am sending it to the
> list for review before applying the patch.
Some comments on the patch itself.
> @@ -2041,8 +2056,8 @@ to switch to the new signature.
> *** Python session return values must be top-level expression statements
>
> Python blocks with ~:session :results value~ header arguments now only
> -return a value if the last line is a top-level expression statement.
> -Also, when a None value is returned, "None" will be printed under
> +return a value if the last line is a top-level expression statement,
> +otherwise the result is None. Also, None will now show up under
> "#+RESULTS:", as it already did with ~:results value~ for non-session
> blocks.
This is an ORG-NEWS entry for Version 9.4. Is it an intentional change?
> @@ -142,7 +144,9 @@ (defun org-babel-python-table-or-string (results)
> "Convert RESULTS into an appropriate elisp value.
> If the results look like a list or tuple, then convert them into an
> Emacs-lisp table, otherwise return the results as a string."
> - (let ((res (org-babel-script-escape results)))
> + (let ((res (if (string-equal "{" (substring results 0 1))
> + results ;don't covert dicts to elisp
> + (org-babel-script-escape results))))
You may also need to update the docstring for
`org-babel-python-table-or-string' after this change.
> - body)))
> - (`value (let ((tmp-file (org-babel-temp-file "python-")))
> + (if graphics-file
> + (format
> org-babel-python--output-graphics-wrapper
> + body graphics-file)
> + body))))
> + (`value (let ((results-file (or graphics-file
> + (org-babel-temp-file "python-"))))
What about :results graphics file ?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, (continued)
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Ihor Radchenko, 2023/08/20
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Jack Kamm, 2023/08/22
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Ihor Radchenko, 2023/08/17
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Jack Kamm, 2023/08/18
Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Liu Hui, 2023/08/17
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Jack Kamm, 2023/08/18
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Liu Hui, 2023/08/20
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Jack Kamm, 2023/08/20
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Liu Hui, 2023/08/21
- Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots, Jack Kamm, 2023/08/22
Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots,
Ihor Radchenko <=