Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'imports': 0.07; 'brilliant': 0.09; 'executed': 0.09; 'globals': 0.09; 'received:209.85.160.174': 0.09; 'received:mail- gy0-f174.google.com': 0.09; 'statement.': 0.09; 'am,': 0.12; 'much!': 0.15; '"def"': 0.16; 'prepend': 0.16; 'cc:addr:python- list': 0.16; 'wrote:': 0.16; 'issue,': 0.18; 'issue.': 0.19; 'cc:no real name:2**0': 0.20; '(like': 0.21; 'header:In-Reply- To:1': 0.22; 'tue,': 0.23; 'aug': 0.24; 'statement': 0.25; 'string': 0.26; 'function': 0.27; 'bit': 0.28; 'problem': 0.28; 'message-id:@mail.gmail.com': 0.29; 'environment': 0.29; 'cc:addr:python.org': 0.30; 'definition': 0.30; 'does': 0.32; 'too': 0.33; 'there': 0.33; '(as': 0.34; 'received:209.85.160': 0.35; 'cc:2**1': 0.36; 'could': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'user': 0.39; 'empty': 0.39; 'needed.': 0.39; 'subject:from': 0.40; 'your': 0.61; 'august': 0.70; 'want,': 0.71; 'soon': 0.72; 'spoke': 0.73; '30,': 0.74; 'locals': 0.84; 'subject:value': 0.84; 'supplying': 0.84; 'subject:better': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=c4gZSDVlJM4aM/8mdeOmTamL2VWjcCcuB3A5ZD3pzyk=; b=Aa6T+Vy7bGJX4u2Z5jo+xvSe8DGIVvXjxRnN2jKm0oSB+Oe9MmQn2xO+ZFVv/PNOul LgHQEEoWSjibxKKb9Tn+hUqg/GhIsKDgIoxp7+OzlhJYYvFjPmD0GF2ghNWmaPBnH/T3 oAz61dwxt8G1ABZ7XT0dxEcBLl2DcXYNczxa0= MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 30 Aug 2011 22:05:07 +0100 Subject: Re: Returning a value from exec or a better solution From: Arnaud Delobelle To: Jack Trades Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org, Rob Williscroft X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314738309 news.xs4all.nl 2462 [2001:888:2000:d::a6]:35140 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12449 On 30 August 2011 13:31, Jack Trades wrote: > > > On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: > >> >> > That's brilliant and works flawlessly. =C2=A0Thank you very much! >> >> If an impementation (as you say up thread) can populate globals >> or locals with whatever they want, then how do you know that last >> item added was the function definition the user supplied ? That's not an issue. The last statement that is executed will be the "def" statement. >> Rob. > > I spoke a bit too soon with the "works flawlessly" post.=C2=A0 In additio= n to > your issue, there is also the problem that supplying an empty environment > does not allow the user to call necessary functions (like scheme_eval). You could simply prepend the function definition string with whatever imports are needed. --=20 Arnaud