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


Groups > comp.lang.python > #16386 > unrolled thread

Re: python 2.5 and ast

Started byArnaud Delobelle <arnodel@gmail.com>
First post2011-11-29 10:11 +0000
Last post2011-11-29 10:11 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python 2.5 and ast Arnaud Delobelle <arnodel@gmail.com> - 2011-11-29 10:11 +0000

#16386 — Re: python 2.5 and ast

FromArnaud Delobelle <arnodel@gmail.com>
Date2011-11-29 10:11 +0000
SubjectRe: python 2.5 and ast
Message-ID<mailman.3122.1322561470.27778.python-list@python.org>
On 29 November 2011 09:51, Andrea Crotti <andrea.crotti.0@gmail.com> wrote:

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

Why don't you just:

try:
    from ast import parse, NodeVisitor
except ImportError:
    from psi.devsonly.ast import parse, NodeVisitor

-- 
Arnaud

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web