python 2.5 and ast

Arnaud Delobelle arnodel at gmail.com
Tue Nov 29 05:11:06 EST 2011


On 29 November 2011 09:51, Andrea Crotti <andrea.crotti.0 at 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



More information about the Python-list mailing list