From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id GOmBGJ4N3mSZQgAASxT56A (envelope-from ) for ; Thu, 17 Aug 2023 14:07:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MKOSF54N3mQ1rgAAG6o9tA (envelope-from ) for ; Thu, 17 Aug 2023 14:07:58 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1806B3BBF0 for ; Thu, 17 Aug 2023 14:07:58 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=SHElr9Up; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692274078; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=e0HVu6ljTgPsGautLKnz5Ee9LTY1KmGgZSQgWGyzvpM=; b=T+d7Y3kcDH3j5KsZJ1J0YiEysCIN0ORR9ZJHFTt7EoqVQ6+oKNpG1nkbQTvND6dsdqGKZb 0XXC3yRL+4pe8KiZc2f0y5Cn8mRu3f8zqtgvRaDYl8Q+WTZno0patskD4rA/OUutEyya8+ VTw5bZjqy8kNfwWfAjEPSTYIXD9uoFOIvueXVikt3IgSe4u02pkAOcyeoMA2kJFrSryFZV rEpcDV9Rv/zqaGa4e0MPtflWbAWWL/dhMeRsHJE1YFHSdwx2Y7squ2tJuO2FEAq3TiKhBE q8krUdVgqJFpaSevs17vq+KHWGVfGK911ndZm3a6A7jWlYzcO0vLAvVvJE5VRA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=SHElr9Up; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692274078; a=rsa-sha256; cv=none; b=dcuvHJz45bjuOlEFmhZhGRgGkZSrtkOPC2pPTzVkJqmsydGAQ5bF2UA3l6RqAUBn3gUawa QdHdEpNnC9+hJRKRqlJeaM5Ox49WMn0R5zbYdYTjxDGWoXQZm642A64c+6qnYYFFqtTE10 3/dERCIDxk/OXEvmCb23o1N3PHjUD2OhDyi1IyDaYm1D9a7VJ2IUHQNDw3ckkvx7NrGZdl r+KbOIS9QVp1xfA8wnbtvugG1wlYmZQmIgEiC02LuJWCD1TNZ0ILOPK4w1Jr7avPzB9d+F 7VWZfu7VFAW0H7P696KXtMD/GafQyH5i9s54CZWiay53cWlpdLL8HCHdHhNsuQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbmV-00067q-8o; Thu, 17 Aug 2023 08:07:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWbmR-00067f-Sf for emacs-orgmode@gnu.org; Thu, 17 Aug 2023 08:07:12 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWbmO-0005lo-LA for emacs-orgmode@gnu.org; Thu, 17 Aug 2023 08:07:11 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id D93FC240029 for ; Thu, 17 Aug 2023 14:07:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692274024; bh=F7zsI5qyQd5/y8Elq1wkvPxXGMEYOMd73Tbm7/ZY0OE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=SHElr9UpBy76XVXW9nx+GgF9NoUsG4UHaeNlPIlpCd0pUmLOExUvHE9wqlr7m5KMC moahXEtgJSAd5vCeAAneMHWHffE507jdolrj1mDBeP8fKtd8c0xJLNpui4NW9eHOYR fTcedGeC5MljhqMOWBbe13Hf39u0CVyUfyBXxUBBG/rBIWZJ5zfUk02v78vTvqHl67 1sZ6Df3pwXN622XOuN1HQbn32xbir7m2OAMb5EeW5VUYjb8pbCYDjb4/fh8O1o8BdL inzlwQlMWuwf9hGk/nyovIUljD8KK6MAPf6VOoBqPPxoxNzCnR1yoZy3/z43MyEq8+ zpG18hUDf9qsQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RRNzD1SLzz9rxB; Thu, 17 Aug 2023 14:07:04 +0200 (CEST) From: Ihor Radchenko To: Jack Kamm Cc: emacs-orgmode@gnu.org, Liu Hui Subject: Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots In-Reply-To: <87350i9uwv.fsf@gmail.com> References: <87a5ur6f7w.fsf@gmail.com> <871qg3pc2o.fsf@localhost> <87350i9uwv.fsf@gmail.com> Date: Thu, 17 Aug 2023 12:07:32 +0000 Message-ID: <87a5uprhx7.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -8.14 X-Spam-Score: -8.14 X-Migadu-Queue-Id: 1806B3BBF0 X-Migadu-Scanner: mx1.migadu.com X-TUID: pRX4hSczRmu3 Jack Kamm 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 . Support Org development at , or support my work at