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


Groups > comp.lang.python > #105625

Re: newbie question

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!2.us.feeder.erje.net!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail
From Grant Edwards <invalid@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: newbie question
Date Thu, 24 Mar 2016 15:05:30 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 23
Message-ID <nd0vnq$jik$2@reader1.panix.com> (permalink)
References <56f3c3eb$0$4546$426a74cc@news.free.fr> <mailman.86.1458816553.2244.python-list@python.org> <56f3f16f$0$1595$c3e8da3$5496439d@news.astraweb.com>
NNTP-Posting-Host c-24-118-110-103.hsd1.mn.comcast.net
X-Trace reader1.panix.com 1458831930 20052 24.118.110.103 (24 Mar 2016 15:05:30 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Thu, 24 Mar 2016 15:05:30 +0000 (UTC)
User-Agent slrn/1.0.2 (Linux)
Xref csiph.com comp.lang.python:105625

Show key headers only | View raw


On 2016-03-24, Steven D'Aprano <steve@pearwood.info> wrote:
> On Thu, 24 Mar 2016 09:49 pm, David Palao wrote:
>
>> Hi,
>> Use "eval":
>> s = "(1, 2, 3, 4)"
>> t = eval(s)
>
> Don't use eval unless you absolutely, categorically, 100% trust the source
> of the string.

And then still don't use it. :)

eval is only safe if you're passing it a literal string containing
nothing but a literal constant expression -- in which case the eval is
superflous.

OK, I admit I've used it for quick hacks on occasion.  But, I
shouldn't have.

-- 
Grant

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


Thread

newbie question "ast" <nomail@com.invalid> - 2016-03-24 11:39 +0100
  Re: newbie question David Palao <dpalao.python@gmail.com> - 2016-03-24 11:49 +0100
    Re: newbie question "ast" <nomail@com.invalid> - 2016-03-24 11:54 +0100
    Re: newbie question Steven D'Aprano <steve@pearwood.info> - 2016-03-25 00:53 +1100
      Re: newbie question Grant Edwards <invalid@invalid.invalid> - 2016-03-24 15:05 +0000
        Re: newbie question wxjmfauth@gmail.com - 2016-03-24 10:11 -0700
  Re: newbie question Matt Wheeler <m@funkyhat.org> - 2016-03-24 10:57 +0000
  Re: newbie question Tim Chase <python.list@tim.thechases.com> - 2016-03-24 05:58 -0500
  Re: newbie question "Sven R. Kunze" <srkunze@mail.de> - 2016-03-24 12:10 +0100
  Re: newbie question Steven D'Aprano <steve@pearwood.info> - 2016-03-24 22:13 +1100
  Re: newbie question Matt Wheeler <m@funkyhat.org> - 2016-03-24 13:22 +0000
    Re: newbie question "ast" <nomail@com.invalid> - 2016-03-28 17:34 +0200
      Re: newbie question "Sven R. Kunze" <srkunze@mail.de> - 2016-03-29 12:23 +0200
  Re: newbie question "Sven R. Kunze" <srkunze@mail.de> - 2016-03-24 18:47 +0100

csiph-web