emacs-orgmode
[Top][All Lists]
Advanced

[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 12:07:32 +0000

Jack Kamm <jackkamm@gmail.com> writes:

> I attach a 2nd patch implementing this. It also makes ":results table"
> the default return type for dict. (Use ":results verbatim" to get the
> dict as a string instead).

Thanks!

>>  #+begin_src python :results list
>>    return {"a": 1, "b": 2}
>>  #+end_src
>>
>>  #+RESULTS:
>>  - a :: 1
>>  - b :: 2
>
> This seems harder, and may require more widespread changes beyond
> ob-python. In particular, I think we'd need to change
> `org-babel-insert-result' so that it can call `org-list-to-org' with a
> list of type "descriptive" instead of "unordered" here:
>
> https://git.sr.ht/~bzg/org-mode/tree/cc435cba71a99ee7b12676be3b6e1211a9cb7285/item/lisp/ob-core.el#L2535

Actually, (org-list-to-org '(unordered ("a :: b") ("c :: d")))
will just work.

We do not support nested lists when transforming output anyway. So,
unordered/descriptive does not matter in practice.

-- 
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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]