Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16386 > unrolled thread
| Started by | Arnaud Delobelle <arnodel@gmail.com> |
|---|---|
| First post | 2011-11-29 10:11 +0000 |
| Last post | 2011-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.
Re: python 2.5 and ast Arnaud Delobelle <arnodel@gmail.com> - 2011-11-29 10:11 +0000
| From | Arnaud Delobelle <arnodel@gmail.com> |
|---|---|
| Date | 2011-11-29 10:11 +0000 |
| Subject | Re: 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
Back to top | Article view | comp.lang.python
csiph-web