From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rustom Mody Subject: babel - python question Date: Fri, 5 Jul 2013 18:14:28 +0530 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2d15a6ba86204e0c30fa9 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uv5Nb-0004IO-Gt for emacs-orgmode@gnu.org; Fri, 05 Jul 2013 08:44:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uv5Na-0006Qy-0z for emacs-orgmode@gnu.org; Fri, 05 Jul 2013 08:44:51 -0400 Received: from mail-ie0-x232.google.com ([2607:f8b0:4001:c03::232]:52066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uv5NZ-0006Qr-SF for emacs-orgmode@gnu.org; Fri, 05 Jul 2013 08:44:49 -0400 Received: by mail-ie0-f178.google.com with SMTP id u16so5232353iet.37 for ; Fri, 05 Jul 2013 05:44:48 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode --001a11c2d15a6ba86204e0c30fa9 Content-Type: text/plain; charset=ISO-8859-1 [Complete babel noob here] Following the babel doc http://orgmode.org/worg/org-contrib/babel/intro.html#library-of-babel I wrote this * Head #+name: ppp :results value #+begin_src python import time print("Hello, today's date is %s" % time.ctime()) print('Two plus two is') return 2 + 2 #+end_src Hit C-c C-c and got a new block #+RESULTS: : 4 I am mystified! In python a top level return gives a syntax error. Here it works. Is some secret function being created? Also the results changed to output does not change the behavior --001a11c2d15a6ba86204e0c30fa9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable [Complete babel noob here]

Following the babel doc http://orgmode.org/worg/org-contrib/babel/intro.html#library-of-bab= el

I wrote this

* Head
#+name: ppp :results value
#+begin_src python
import ti= me
print("Hello, today's date is %s" % time.ctime())
pr= int('Two plus two is')
return 2 + 2
#+end_src

Hit C-c = C-c

and got a new block

#+RESULTS:
: 4


I am mystified!=
In python a top level return gives a syntax error.
Here it works. Is= some secret function being created?

Also the results changed to out= put does not change the behavior
--001a11c2d15a6ba86204e0c30fa9--