Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52993

Re: python eval function

Date 2013-08-25 20:25 -0400
From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: python eval function
References <1377458314.14456.0.camel@debian> <kve55j$pes$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.230.1377476728.19984.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: python eval function Ned Batchelder <ned@nedbatchelder.com> - 2013-08-25 20:25 -0400

csiph-web