Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'binary': 0.05; 'lines.': 0.07; '===': 0.09; 'ast': 0.09; 'operator,': 0.09; 'sat,': 0.15; "('a'": 0.16; 'constants': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'operators,': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'fairly': 0.21; 'pass': 0.25; 'header:In-Reply- To:1': 0.25; 'looks': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'character': 0.29; 'error': 0.30; 'code': 0.31; 'to:addr:python-list': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'add': 0.36; 'possible': 0.37; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'header:Received:5': 0.40; 'first': 0.61; 'more': 0.63; '2013': 0.84; 'edwards': 0.91 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 :content-type; bh=0kqP4l8Ir1SBXrs7y0avhJoPGyzWi/nwroT2+IPrQYw=; b=cAZAbfzQ9Z1YUrk0bM9NVhsDc5r6lOC99NVkK38DVu7TvsmIyEkI7idLbeWPyiprJl WZTVfBAlbAvp7fRawZ/tb36iKXBwkU4Sak3JWJvgJjOfrSSE8oBUtwFvblRc1s37dF3x 0V77/fMGWK5I4rHv7DLlw4qverq5Xs2hqKGu0oQ7QSw8lXDsT4mu1bgHrj1QPu08RgDU NGl+7r8c6vTnpGzV6SXPtVKYCCO8e2icPGkT1g8xKQMRU383rKfWecNn09Cs5A7o6z16 kIYys4HqFEkbN/dvr1PqPOwZUCNbaZwtz59F3bpxUa7RUooYU7nSoAJkMpruSl2+HxA5 MrTw== MIME-Version: 1.0 In-Reply-To: References: <50e6891c$0$30003$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 5 Jan 2013 05:23:28 +1100 Subject: Re: Yet another attempt at a safe eval() call From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357323816 news.xs4all.nl 6947 [2001:888:2000:d::a6]:47362 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36129 On Sat, Jan 5, 2013 at 5:09 AM, Grant Edwards wrote: > The error messages are still pretty cryptic, so improving > that will add a few more lines. One nice thing about the ast code is > that it's simple to add code to allow C-like character constants such > that ('A' === 0x41). Here's the first pass at ast-based code: Looks cool, and fairly neat! Now I wonder, is it possible to use that to create new operators, such as the letter d? Binary operator, takes two integers... ChrisA