Path: csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'string': 0.09; 'exec': 0.09; 'feature.': 0.09; 'sure,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'guys,': 0.16; 'runtime.': 0.16; ':-)': 0.16; 'language': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'thu,': 0.19; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'compilation': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'second': 0.26; 'header:In-Reply- To:1': 0.27; 'feature': 0.29; "doesn't": 0.30; 'important.': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; "we're": 0.32; 'but': 0.35; 'received:google.com': 0.35; 'programming,': 0.36; 'should': 0.36; 'pm,': 0.38; 'dangerous': 0.60; 'day': 0.76; '"look': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=KUAZWr5BKJDF4/ubj05QRFgK2zG+wSKQy+fSe95qZd4=; b=sRd5DokW0UE28c0mNkpWjN+nNPpurOuUnu+9IFWIw8c04CGfY6i8sNDm5fmIW3j685 4SkJPZga+zgs5vRv07/UPmUHjeiTJ9GozGE2fxtLeOSbPU4ZAk15SfUXLEoTfdQnb5uQ EKmF4QGOiAEOl12gdnJhgDtGtm85TrZ3dwGZO0zOmMsSY+YLwQ60KcDW1HevO2Z5vREQ CrSbmRWeiplce2f63UfWEk2Gxd7/9BRE8kpow1t3II6qfhaVg3fFUF1k44C6uGIWEgHY K+nQEbTUnRWU89LDahxehwG/JT5wlBCEGGYSTyjPKvFmPtQTkSwrBYviU4l0O9xtbizT SQkg== MIME-Version: 1.0 X-Received: by 10.68.201.10 with SMTP id jw10mr11243245pbc.25.1393477518446; Wed, 26 Feb 2014 21:05:18 -0800 (PST) In-Reply-To: <530ec365$0$11113$c3e8da3@news.astraweb.com> References: <530de8ed$0$29985$c3e8da3$5496439d@news.astraweb.com> <530e8608$0$11113$c3e8da3@news.astraweb.com> <530ec365$0$11113$c3e8da3@news.astraweb.com> Date: Thu, 27 Feb 2014 16:05:18 +1100 Subject: Re: exec and locals From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393477521 news.xs4all.nl 2902 [2001:888:2000:d::a6]:57466 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67116 On Thu, Feb 27, 2014 at 3:47 PM, Steven D'Aprano wrote: > Guys, I know that exec is kinda dangerous and newbies should be > discouraged from throwing every string they see at it, but this isn't my > second day Python programming, and it's not an accident that Python > supports the dynamic compilation and execution of source code at runtime. > It's a deliberate language feature. We're allowed to use it :-) Code smell means "look at this". It doesn't mean "don't use this feature ever". :) Steven's looked into this thoroughly, I'm sure, and exec is important. ChrisA