Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16557
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.081 |
| X-Spam-Evidence | '*H*': 0.84; '*S*': 0.00; 'compile-time': 0.07; 'subject:python': 0.10; 'warn': 0.16; 'cc:addr:python-list': 0.16; 'this:': 0.16; 'cc:no real name:2**0': 0.20; 'detect': 0.21; 'header:In-Reply-To:1': 0.22; 'string': 0.24; 'cc:2**0': 0.24; 'cc:addr:python.org': 0.29; 'example': 0.29; 'received:mail- bw0-f46.google.com': 0.30; 'user.': 0.31; 'quite': 0.32; 'received:209.85.214': 0.32; "can't": 0.32; 'message- id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'actually': 0.33; 'there': 0.33; 'done.': 0.34; 'skip:" 50': 0.34; 'passed': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'doing': 0.38; 'easiest': 0.38; 'received:10.0.0': 0.38; 'received:209.85': 0.38; 'should': 0.39; 'received:209': 0.40; 'might': 0.40; 'types': 0.61; 'harder': 0.64; 'topic,': 0.77; 'stupid': 0.91; 'visitor': 0.91 |
| 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=djGwV+uhXF9Gyejqb07Co4eCcyyfc6EEqPcvK9x+F60=; b=F55M6JGwWr/EJDWRieudlHQs3iiBszJ9Ltd9FItOPlL9miZLYYVQJE2aJAy8RVVR0z sVad195fdBhm6oKP3okM9PlEL+PbYr9PmzczAK1RYuL8U5Giaj0UlGDgm6JCtQcScmtV IP7R3QItwc5rN9qDQ8VVu6EvT5Zp+fr2spvEQ= |
| Date | Fri, 02 Dec 2011 17:01:47 +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 | DevPlayer <devplayer@gmail.com> |
| 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> <4ED4E35E.6090405@gmail.com> <mailman.3166.1322676221.27778.python-list@python.org> <4bbaa89c-55d2-40d1-91fb-cb00c3f2239a@s4g2000yqk.googlegroups.com> <4ED902CA.7090404@gmail.com> |
| In-Reply-To | <4ED902CA.7090404@gmail.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.3231.1322845312.27778.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1322845312 news.xs4all.nl 6986 [2001:888:2000:d::a6]:41674 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:16557 |
Show key headers only | View raw
And on a related topic, how can I actually detect other types of
imports, for example
__import__
Doing a dump I get this:
In [113]: ast.dump(ast.parse('__import__("module")'))
Out[113]: "Module(body=[Expr(value=Call(func=Name(id='__import__',
ctx=Load()), args=[Str(s='module')], keywords=[], starargs=None,
kwargs=None))])"
So the visitor should be quite smart, and the string passed can't be
always be done.
I think the easiest way is just to use regexp and look for them warning
the user that there might be other
stupid imports, the harder way is to try to detect it and if the string
passed is actually known at compile-time
use it, otherwise warn the user.
Back to comp.lang.python | Previous | Next — Previous 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