Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!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.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'example:': 0.03; 'exec': 0.07; 'am,': 0.12; 'namespace.': 0.16; 'wrote:': 0.16; 'wed,': 0.17; 'cheers,': 0.18; "haven't": 0.20; 'header:In-Reply-To:1': 0.22; 'aug': 0.24; 'code.': 0.26; "i'm": 0.27; 'message- id:@mail.gmail.com': 0.29; 'print': 0.29; 'example': 0.30; 'none,': 0.30; 'break': 0.32; 'to:addr:python-list': 0.33; 'that,': 0.33; 'certain': 0.35; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'to:addr:python.org': 0.39; 'subject:from': 0.40; '31,': 0.64; 'subject:value': 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:from:date:message-id:subject:to :content-type; bh=nFeLWue3Hp/tBSpPTy9dfHxLKfOP5Bm1wXex46sVk54=; b=B9QwyCwHjmdVZ97gawnGkYwc70Z+C+6Gri5jR4b3xdCvCk+WhqzdK4Y0rm59mGL2Pl oOiUoKe+4LAi8k8E50IiYYEl3SuGX2KcmSL1d4rNTwMqS+L5FHtDOLoJB9AgHEd1ACjP 17AQWhkVpkoW36jNp43hNxUVTR2LduKvJAZZs= MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Wed, 31 Aug 2011 08:25:43 -0600 Subject: Re: Returning a value from exec or a better solution To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314800774 news.xs4all.nl 2437 [2001:888:2000:d::a6]:41705 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12479 On Wed, Aug 31, 2011 at 12:35 AM, Arnaud Delobelle wrote: >> You don't know that, an implementation may for example set __bultins__ >> to None, prior to returning, its not an unreasonable thing to do and >> the docs don't say they can't. > > I haven't studied the docs but I'm certain that such an implementation > would break a lot of code. For example: a = 42 exec "a += 1729" print(a) ...since print would no longer be available in the global namespace. Cheers, Ian