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


Groups > comp.lang.python > #16385

Re: python 2.5 and ast

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!txtfeed1.tudelft.nl!tudelft.nl!txtfeed2.tudelft.nl!amsnews11.chello.com!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
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; 'else:': 0.03; 'sys': 0.05; 'subject:python': 0.10; 'am,': 0.12; 'library': 0.13; 'ast': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'thanks,': 0.18; 'cc:no real name:2**0': 0.20; 'later': 0.21; 'maybe': 0.21; '(or': 0.22; 'header:In-Reply-To:1': 0.22; 'code': 0.25; 'import': 0.27; 'cc:addr:python.org': 0.29; 'received:mail-bw0-f46.google.com': 0.30; 'version': 0.32; 'received:209.85.214': 0.32; 'message- id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'that,': 0.33; 'there': 0.33; 'probably': 0.34; 'something': 0.35; 'test': 0.35; 'cc:2**1': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'doing': 0.38; 'easiest': 0.38; 'received:10.0.0': 0.38; 'received:209.85': 0.38; 'put': 0.38; 'ways': 0.39; 'received:209': 0.40; 'tag': 0.64
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=OdV9wnqkJvoGlH3ypNYpNMdBlKZ4RTDw0gGJzoR11ck=; b=YhdAPNmMb+bwLLQMejUGnYvkkJWpSAPtg2tZ0QFi2iecV2LhVMeVuDFx1sJ5Iyvrff NLZRvoWaxDdq8Dsgpw/pnSMDFzI2O75duqUWadJununZIKWg06psf+J2GKZs5kbx3Ide ic+j8abgYlKWSag45Qe/wJ9BOOi3XbjqSO5nc=
Date Tue, 29 Nov 2011 09:51:24 +0000
From Andrea Crotti <andrea.crotti.0@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111108 Thunderbird/8.0
MIME-Version 1.0
To d@davea.name
Subject Re: python 2.5 and ast
References <4ED37475.3050709@gmail.com> <jb0pnp$a7i$1@dough.gmane.org> <4ED457C5.2020407@davea.name>
In-Reply-To <4ED457C5.2020407@davea.name>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc python-list@python.org, Terry Reedy <tjreedy@udel.edu>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.3121.1322560291.27778.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322560291 news.xs4all.nl 6868 [2001:888:2000:d::a6]:58690
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16385

Show key headers only | View raw


On 11/29/2011 03:55 AM, Dave Angel wrote:
>
> But don't forget to tag it as version specific, so it gets removed 
> when the later version of the library is available.  There are various 
> ways of doing that, but the easiest is probably to put a test in the 
> acceptance suite that fails if this code is used in 2.6 or later.
>

Ok thanks,
something like this is ok?
(or maybe I can use a try/catch and export my own if is not found in the 
standard library?)

from sys import version_info

if version_info[1] == 5:
     from psi.devsonly.ast import parse, NodeVisitor
else:
     from ast import parse, NodeVisitor

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


Thread

Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-11-29 09:51 +0000
  Re: python 2.5 and ast Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-29 11:32 +0000
    Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-11-29 13:51 +0000
    Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-11-30 18:03 +0000
      Re: python 2.5 and ast DevPlayer <devplayer@gmail.com> - 2011-12-02 07:18 -0800
        Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-02 16:54 +0000
        Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-02 17:01 +0000

csiph-web