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


Groups > comp.lang.python > #16385

Re: python 2.5 and ast

Date 2011-11-29 09:51 +0000
From Andrea Crotti <andrea.crotti.0@gmail.com>
Subject Re: python 2.5 and ast
References <4ED37475.3050709@gmail.com> <jb0pnp$a7i$1@dough.gmane.org> <4ED457C5.2020407@davea.name>
Newsgroups comp.lang.python
Message-ID <mailman.3121.1322560291.27778.python-list@python.org> (permalink)

Show all headers | 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