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


Groups > comp.lang.python > #45653

Re: Question about ast.literal_eval

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin.stu.neva.ru!news.astraweb.com!border5.a.newsrouter.astraweb.com!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <fabiosantosart@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'pop': 0.05; 'subject:Question': 0.07; 'subject:skip:a 10': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'suggest': 0.14; 'ast': 0.16; 'bracket,': 0.16; 'brackets.': 0.16; 'think.': 0.16; 'wrote:': 0.18; 'stack': 0.19; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '&gt;': 0.26; 'push': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'something': 0.35; 'received:google.com': 0.35; 'level': 0.37; 'issue': 0.38; "you're": 0.61; 'address': 0.63; 'results': 0.69; 'walking': 0.91; 'imagine': 0.93; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=spk9UYxvNWpsrSM5eML3Uyohpcg2ct802wBQRAEJVm0=; b=wB8uqvzGrvYuphbA5F3MRCgmPv/bVDaPP58VKgAT/fYTiNptw/dG3QAXR6x+lyPN2X SPyCueTNisajz5Yd9OgSu5sfscq60MkNBb9JH7chO218a/mgdsXxRklq4CmAX5dJmSI2 9iChGPmdTgVeJk0btXpsv/S1Ei04vP4N+3d7zEAnoMeRXXFfqxq6oJnlOqFQQwLUy/IU UZtEOwGKw3ggt4icLRfrC98UeoRmwn5LFwSD1g5n38lTmpJb7xrmQMI1098azmzsOFSr k9ixSq1d0dII6IhubHowknhI0AIXvKADcENakRPUPVAEeGkErghf65KJXGT80BsQivbH NUlQ==
MIME-Version 1.0
X-Received by 10.224.192.6 with SMTP id do6mr1508817qab.82.1369124596494; Tue, 21 May 2013 01:23:16 -0700 (PDT)
In-Reply-To <knf9u3$rr0$1@ger.gmane.org>
References <knci07$jol$1@ger.gmane.org> <BLU176-W37EB377C73CD6D7306247DD7AF0@phx.gbl> <knckj0$cft$1@ger.gmane.org> <CAPTjJmpb073XFH5ksNhzRyAJNSJF=6WNq5pGzed4PXqBrJBN=A@mail.gmail.com> <knclk6$lva$1@ger.gmane.org> <mailman.1888.1369056365.3114.python-list@python.org> <519a4b6a$0$29997$c3e8da3$5496439d@news.astraweb.com> <mailman.1905.1369117820.3114.python-list@python.org> <519b2096$0$6574$c3e8da3$5496439d@news.astraweb.com> <knf9u3$rr0$1@ger.gmane.org>
Date Tue, 21 May 2013 09:23:16 +0100
Subject Re: Question about ast.literal_eval
From Fábio Santos <fabiosantosart@gmail.com>
To Frank Millman <frank@chagford.com>
Content-Type multipart/alternative; boundary=20cf300fb1cb3a542c04dd3629ec
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.1910.1369124922.3114.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369124922 news.xs4all.nl 16003 [2001:888:2000:d::a6]:43041
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45653

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 21 May 2013 09:10, "Frank Millman" <frank@chagford.com> wrote:
> It doesn't address the issue of brackets. I imagine that the answer is
something like -
>
>   maintain a stack of results
>   for each left bracket, push a level
>   for each right bracket, pop the result
>
> or something ...
>

Time for me to suggest pyparsing or PLY. You're better off creating your
own AST and walking it to produce python or SQL than reinventing the wheel,
I think.

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


Thread

Re: Question about ast.literal_eval Frank Millman <frank@chagford.com> - 2013-05-20 15:26 +0200
  Re: Question about ast.literal_eval Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-20 16:12 +0000
    Re: Question about ast.literal_eval Chris Angelico <rosuav@gmail.com> - 2013-05-21 02:23 +1000
    Re: Question about ast.literal_eval Frank Millman <frank@chagford.com> - 2013-05-21 08:30 +0200
      Re: Question about ast.literal_eval Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-21 07:21 +0000
        Re: Question about ast.literal_eval Frank Millman <frank@chagford.com> - 2013-05-21 10:06 +0200
        Re: Question about ast.literal_eval Fábio Santos <fabiosantosart@gmail.com> - 2013-05-21 09:23 +0100
        Re: Question about ast.literal_eval Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-21 10:00 +0100

csiph-web