emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ahmadou Dicko <dicko.ahmadou@gmail.com>
To: Soapy Smith <soapy-smith@comcast.net>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Python Code Block error with header option :results output
Date: Fri, 31 Jan 2014 21:33:36 +0000	[thread overview]
Message-ID: <CAP8THHWrFiJ8dvmdWCKkzi9u-ekUbcyzFaMVpNPsALk3hu55gg@mail.gmail.com> (raw)
In-Reply-To: <1391203457.2534.18.camel@raven-CM5571>

[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]

I'm not a Python expert too but I don't that return statement can be used
as is on the fly.
So, yes is the expected behavior of Python

Try instead

#+begin_src python :results output
  a = (1, 2, 3, 4)
  print(a)
#+end_src

#+RESULTS:
: (1, 2, 3, 4)



On Fri, Jan 31, 2014 at 9:24 PM, Soapy Smith <soapy-smith@comcast.net>wrote:

> Hello-
>
> I am not a user of Python (yet).  During a comparison of code block
> behavior between Clojure and Python, I discovered a possible Python
> error.
>
> Here is the code block:
>
> #+begin_src python :results output
>  a = (1, 2, 3, 4)
>  return a
> #+end_src
>
> The evaluation of this block results in this error:
>
>   File "<stdin>", line 2
> SyntaxError: 'return' outside function
>
> Could someone please comment if this is expected Python behavior?
>
> I am using org 8.2.4.
>
> Regards,
> Greg
>
>
>


-- 
Ahmadou H. DICKO
statistician economist (Ingénieur Statisticien Économiste)
PhD candidate in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land
Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
email : ahmadou.dicko@ucad.edu.sn
twitter : @dickoah
github : github/dickoa <https://github.com/dickoa>
tel : +221 33 827 55 16
portable: +221 77 123 81 69

[-- Attachment #2: Type: text/html, Size: 2001 bytes --]

  reply	other threads:[~2014-01-31 21:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31 16:50 Export Dispatcher Insert Template Not Working? Soapy Smith
2014-01-31 17:04 ` Bastien
2014-01-31 21:05   ` Soapy Smith
2014-01-31 21:24 ` Python Code Block error with header option :results output Soapy Smith
2014-01-31 21:33   ` Ahmadou Dicko [this message]
2014-01-31 21:33   ` Eric Schulte
2014-02-01  6:56     ` Christian Moe
2014-02-01 12:34       ` Soapy Smith
2014-01-31 21:45 ` Code block option :results raw does not replace #+RESULTS Soapy Smith
2014-01-31 21:54   ` John Hendy
2014-01-31 23:16   ` Nick Dokos
2014-02-01 12:01     ` Soapy Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP8THHWrFiJ8dvmdWCKkzi9u-ekUbcyzFaMVpNPsALk3hu55gg@mail.gmail.com \
    --to=dicko.ahmadou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=soapy-smith@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).