Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16386
| References | <4ED37475.3050709@gmail.com> <jb0pnp$a7i$1@dough.gmane.org> <4ED457C5.2020407@davea.name> <4ED4AB1C.3080609@gmail.com> |
|---|---|
| Date | 2011-11-29 10:11 +0000 |
| Subject | Re: python 2.5 and ast |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3122.1322561470.27778.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: python 2.5 and ast Arnaud Delobelle <arnodel@gmail.com> - 2011-11-29 10:11 +0000
csiph-web