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


Groups > comp.lang.python > #16386

Re: python 2.5 and ast

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <arnodel@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'sys': 0.05; 'importerror:': 0.07; 'subject:python': 0.10; 'ast': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'header:In-Reply- To:1': 0.22; 'received:209.85.213.46': 0.23; 'received:mail- yw0-f46.google.com': 0.23; 'import': 0.27; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'cc:2**2': 0.34; 'try:': 0.34; 'except': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'why': 0.39; 'received:209': 0.40; '2011': 0.61; 'andrea': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=eKXuJDhHEGaMWKh1bM8YIq6ruph/8E1K95g9dYnc43I=; b=KwY2h126EXw3Aml+cW5hWH9HjN8sVClLCZGza7Fdh5zLDP+TpnMeVj5KBXRKOuvKR7 RBQ2fhndpjWI4B02uasMhfN4L1VTFUkoTA7Z4il+prWVI9eMUS3b10nFsytkyTbzPLQS tjO1brI5nz2xtPBkJmgHoWq0lbzpRs4n4XcHA=
MIME-Version 1.0
In-Reply-To <4ED4AB1C.3080609@gmail.com>
References <4ED37475.3050709@gmail.com> <jb0pnp$a7i$1@dough.gmane.org> <4ED457C5.2020407@davea.name> <4ED4AB1C.3080609@gmail.com>
Date Tue, 29 Nov 2011 10:11:06 +0000
Subject Re: python 2.5 and ast
From Arnaud Delobelle <arnodel@gmail.com>
To Andrea Crotti <andrea.crotti.0@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org, d@davea.name, Terry Reedy <tjreedy@udel.edu>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3122.1322561470.27778.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322561470 news.xs4all.nl 6971 [2001:888:2000:d::a6]:56216
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16386

Show key headers only | View raw


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


Thread

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

csiph-web