Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53004
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mohsen@pahlevanzadeh.org> |
| 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; 'answer?': 0.09; 'exec': 0.09; 'input,': 0.09; 'slow.': 0.09; 'cc:addr:python-list': 0.11; 'idea:': 0.16; 'questioned': 0.16; 'slow,': 0.16; 'task.': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'unsafe': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'all,': 0.19; 'solution.': 0.20; 'written': 0.21; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'rid': 0.24; 'mon,': 0.24; '(or': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'post': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'external': 0.29; "doesn't": 0.30; 'skip:@ 10': 0.30; 'waste': 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'anyone': 0.31; 'run': 0.32; 'basic': 0.35; 'there': 0.35; 'collecting': 0.36; "didn't": 0.36; 'useful': 0.36; 'thank': 0.38; "you're": 0.61; 'first': 0.61; 'name': 0.63; 'field': 0.63; 'dear': 0.65; 'answer.': 0.68; 'sharing': 0.69; 'link:': 0.72; 'future,': 0.83; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pahlevanzadeh.org; s=default; h=Content-Transfer-Encoding:Mime-Version:Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID; bh=IxFQMMWApju/gf7FLpGgQhy4HI6xesKNDIuLbnzK8B4=; b=piFQqvZMxlyP2T7iQnTZDFkvWv9POPdYfwF8GasXge9VtVNrLKIgL58fr7D4iBWtcGGUq3LQ1HddCLi0Qhmzrtgz8q+G2WKt8DjgDmzGHCB0KlALGIqT1hmkv/Z62b/PQ0KJIagEQ52vhmn/iLiE1LDfJQdYVMkjaTP6FMolCls=; |
| Subject | Re: python eval function |
| From | Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> |
| To | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
| Date | Mon, 26 Aug 2013 19:43:53 +0430 |
| In-Reply-To | <521aa76a$0$29986$c3e8da3$5496439d@news.astraweb.com> |
| References | <mailman.228.1377474113.19984.python-list@python.org> <521aa76a$0$29986$c3e8da3$5496439d@news.astraweb.com> |
| Content-Type | text/plain; charset="UTF-8" |
| X-Mailer | Evolution 3.4.4-4+b1 |
| Mime-Version | 1.0 |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - part7.royal-servers.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - pahlevanzadeh.org |
| X-Get-Message-Sender-Via | part7.royal-servers.com: authenticated_id: mohsen@pahlevanzadeh.org |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.237.1377530050.19984.python-list@python.org> (permalink) |
| Lines | 43 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1377530050 news.xs4all.nl 15899 [2001:888:2000:d::a6]:48038 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:53004 |
Show key headers only | View raw
On Mon, 2013-08-26 at 00:55 +0000, Steven D'Aprano wrote: > On Sun, 25 Aug 2013 23:48:34 +0430, Mohsen Pahlevanzadeh wrote: > > > Dear all, > > > > eval doesn't run my code at the following link: > > http://stackoverflow.com/questions/18432198/eval-function-doesnt-work- > in-python > > > Are you asking a question or just sharing a useful link? > > > > > Thank you before your answer... > > What question do you want us to answer? The question on Stackoverflow has > already been answered correctly: there is no need to use eval (or exec) > for this basic task. > > Also, you're not writing C code. Get rid of the semi-colons, they are > just a waste of time, and make you look like an incompetent programmer. > > Using exec is not the right solution. That is unsafe, if the field name > and content come from a database or external input, your code now has a > *serious* Code Injection vulnerability. AND it is slow. So you have > written slow, unsafe code. Get rid of it, and use setattr like you have > already been told: > > setattr(self, fieldName, fieldValue) > > > > -- > Steven I didn't post a useful link,i questioned my problem.Of course, At first i put it @stackoverflow then post its link for the following idea: 1. collecting votes for me and someone answered. 2. If anyone have my question in future, can use it. Thank you for answer. --mohsen
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
python eval function Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> - 2013-08-25 23:48 +0430
Re: python eval function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-26 00:55 +0000
Re: python eval function Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> - 2013-08-26 19:43 +0430
csiph-web