Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'lines,': 0.07; 'oh,': 0.09; 'language.': 0.14; '(code': 0.16; 'dict': 0.16; 'reedy': 0.16; 'unnecessary.': 0.16; 'subject:python': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'variable': 0.18; 'trying': 0.19; 'seems': 0.21; 'programming': 0.22; 'header:User- Agent:1': 0.23; 'instead.': 0.24; 'rid': 0.24; 'header:In-Reply- To:1': 0.27; "doesn't": 0.30; 'code': 0.31; 'probably': 0.32; 'run': 0.32; 'another': 0.32; 'received:google.com': 0.35; 'there': 0.35; 'ends': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'link:': 0.72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=qs5FZrGPWE2cJTgtAaEGRWsnVySwLBrtwF4B2Rp/DRs=; b=e2IgvnAaHl39AaLtvb/kCVvKA0HW5RIw/ghFQMy4SKte/ugUAEhEGoRPoe9P51fAsD begXn/lDgXGtOz33aZeAVXPPSQgUFY314q8qA/WwzJPR7wW+t/FUPCdwxQeMDQxrB7i8 C7fjt5Cua/BYVoHb0UZyC5d39hXcQp8lYti5fLmamGL6BvaU9NryLO/9O63/Pl2hohwW knkhrtvXMoM0DMd5Ya9PoLsnmdv7vrMdhEXYKvtay1BlH1dggcWn/Wa4jroIJ935OoNZ +W3BLUG4sSXgg3EsMhmRXNQ92luvIcBzao7uxDcIRYkIR2tUWsb20mNeLSUESDj4o9K+ fDcQ== X-Received: by 10.224.131.4 with SMTP id v4mr13023605qas.44.1377476719481; Sun, 25 Aug 2013 17:25:19 -0700 (PDT) Sender: Ned Batchelder Date: Sun, 25 Aug 2013 20:25:17 -0400 From: Ned Batchelder User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: python-list@python.org Subject: Re: python eval function References: <1377458314.14456.0.camel@debian> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377476728 news.xs4all.nl 15879 [2001:888:2000:d::a6]:33373 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52993 On 8/25/13 7:49 PM, Terry Reedy wrote: > On 8/25/2013 3:18 PM, Mohsen Pahlevanzadeh wrote: > >> eval doesn't run my code at the following link: >> http://stackoverflow.com/questions/18432198/eval-function-doesnt-work-in-python >> > > Already answered there (code is statememt, not expression) > The larger issue is that your use of eval seems unnecessary. If you are trying to set variable variable names, you probably want a dict instead. Oh, and get rid of the semicolons at the ends of lines, they are unnecessary and a sign of old habits from another programming language. --Ned.