Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Sven R. Kunze" Newsgroups: comp.lang.python Subject: Re: newbie question Date: Tue, 29 Mar 2016 12:23:39 +0200 Lines: 30 Message-ID: References: <56f3c3eb$0$4546$426a74cc@news.free.fr> <56F3CB1E.2000606@mail.de> <56f94f18$0$3314$426a34cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de sR1ZJypcf4HqCuM+mh7y9wQX7WYAxjs202fxde9eadsw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'think,': 0.05; 'subject:question': 0.08; '(1,': 0.09; 'ast': 0.09; 'things.': 0.15; 'thu,': 0.15; '2016': 0.16; 'doc,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skip:n 50': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'suppose': 0.22; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'module': 0.25; 'equally': 0.29; 'received:10.0': 0.34; 'gets': 0.35; 'best,': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; "didn't": 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'mar': 0.65; 'dans': 0.72; 'safety.': 0.84; 'shares': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1459247025; bh=BRCkSV1PdS9p01vNFx1i/znIDyc8Oh8jq6qxRVM/lmg=; h=Subject:To:References:From:Date:In-Reply-To:From; b=jl7gJSmE4xxegl5Dlt/5GD3q+n4XbwpqcwY/18+g+ODhS857NEewLe8Ab/gajaHrs QD0oUaPQpqRlI9KkjA8BcRMjSpVFCIOHDuJoZ4ZkfoR1ABP+MJEGiBeufU5du4cA/a 30t+V3gxwnJ+v5FLCoGCDeDyPd+HbmnRhReEX4/g= In-Reply-To: <56f94f18$0$3314$426a34cc@news.free.fr> X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 789 X-purgate-ID: 154282::1459247024-00004575-C2378C25/0/0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105975 On 28.03.2016 17:34, ast wrote: > > "Matt Wheeler" a écrit dans le message de > news:mailman.92.1458825746.2244.python-list@python.org... >> On Thu, 24 Mar 2016 11:10 Sven R. Kunze, wrote: >> >>> On 24.03.2016 11:57, Matt Wheeler wrote: >>> >>>> import ast >>> >>>> s = "(1, 2, 3, 4)" >>> >>>> t = ast.literal_eval(s) >>> >>>> t >>> > (1, 2, 3, 4) >>> >>> I suppose that's the better solution in terms of safety. >>> >> >> It has the added advantage that the enquirer gets to import a module >> that >> shares their name ;) > > > I had a look at that "ast" module doc, but I must admit that > I didn't understood a lot of things. If there were a module "srkunze", I think, I would be equally surprised. ;) Best, Sven