Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16391
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!newsfeed10.multikabel.net!spool10.prolocation.net!multikabel.net!newsfeed20.multikabel.net!amsnews11.chello.com!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <andrea.crotti.0@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'sys': 0.05; 'importerror:': 0.07; 'subject:python': 0.10; 'am,': 0.12; 'ast': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'try/except': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'string,': 0.18; 'cc:no real name:2**0': 0.20; 'header:In- Reply-To:1': 0.22; 'cc:2**0': 0.24; 'import': 0.27; 'fact': 0.27; 'looks': 0.29; 'cc:addr:python.org': 0.29; 'correct': 0.29; "i've": 0.31; 'idea': 0.32; 'message-id:@gmail.com': 0.33; 'header :User-Agent:1': 0.33; 'probably': 0.34; 'try:': 0.34; 'but': 0.37; 'except': 0.37; 'received:google.com': 0.37; 'using': 0.38; 'received:10.0.0': 0.38; 'steven': 0.38; 'received:209.85': 0.38; 'received:209': 0.40; 'more': 0.61 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=6k4Tx7/9Yv48bQ1o8tC79LL59otDDAyqjyYhhRamecw=; b=LjhQyG4ZM7VQ/J2ewKSl71L3IwNkBDCRJrZHVnwuKaFT6J6Ig+lHhjf70uUeUJG/B7 jlyw8gvbClcQ2dOfw+ZjrJbyjIKJjN5wBgxQWOsII2fRq+p9Ah3XNtywhFnl+RuehfJl MsKqDcz3nC6NMgs072hG9c5+BYKjdZQir37k8= |
| Date | Tue, 29 Nov 2011 13:51:26 +0000 |
| From | Andrea Crotti <andrea.crotti.0@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111108 Thunderbird/8.0 |
| MIME-Version | 1.0 |
| To | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
| Subject | Re: python 2.5 and ast |
| References | <4ED37475.3050709@gmail.com> <jb0pnp$a7i$1@dough.gmane.org> <4ED457C5.2020407@davea.name> <mailman.3121.1322560291.27778.python-list@python.org> <4ed4c2ce$0$29988$c3e8da3$5496439d@news.astraweb.com> |
| In-Reply-To | <4ed4c2ce$0$29988$c3e8da3$5496439d@news.astraweb.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Cc | python-list@python.org |
| 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.3124.1322574694.27778.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1322574694 news.xs4all.nl 6924 [2001:888:2000:d::a6]:60544 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16391 |
Show key headers only | View raw
On 11/29/2011 11:32 AM, Steven D'Aprano wrote: > > I prefer to check against sys.version. > > import sys > if sys.version<= '2.5': > from psi.devsonly.ast import parse, NodeVisitor > else: > from ast import parse, NodeVisitor > > > > Or even: > > > try: > from ast import parse, NodeVisitor > except ImportError: > from ast import parse, NodeVisitor > > > The try/except is probably the nicest... I've seen in other places using sys.version <=, but is it a good idea to rely on the fact that the <= on strings has the right semantic? After all that's just a string, version_info looks more correct to me..
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-11-29 09:51 +0000
Re: python 2.5 and ast Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-29 11:32 +0000
Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-11-29 13:51 +0000
Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-11-30 18:03 +0000
Re: python 2.5 and ast DevPlayer <devplayer@gmail.com> - 2011-12-02 07:18 -0800
Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-02 16:54 +0000
Re: python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-02 17:01 +0000
csiph-web