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


Groups > comp.lang.python > #16563

Re: python 2.5 and ast

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 <dihedral88888@googlemail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'happily': 0.07; 'python': 0.08; 'scripts': 0.09; 'garbage': 0.09; 'reply- to:addr:comp.lang.python': 0.09; 'to:addr:comp.lang.python': 0.09; 'subject:python': 0.10; 'ast': 0.16; 'nodes': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.18; 'yet.': 0.18; 'cc:no real name:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'tree.': 0.23; 'way?': 0.23; 'cc:2**0': 0.24; "python's": 0.24; 'tree': 0.25; 'code': 0.25; 'module': 0.26; "i'm": 0.26; 'received:209.85.220': 0.27; 'code,': 0.27; 'cc:addr:python.org': 0.29; 'array': 0.30; 'finite': 0.30; 'hash': 0.30; 'indexed': 0.30; 'source': 0.31; 'done,': 0.32; 'list': 0.32; 'sort': 0.33; 'header:User-Agent:1': 0.33; 'there': 0.33; 'from:addr:googlemail.com': 0.34; 'but': 0.37; 'run': 0.37; 'received:google.com': 0.37; 'enough': 0.38; 'using': 0.38; 'monday,': 0.38; 'replace': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'tasks': 0.39; 'received:209': 0.40; '2011': 0.61; 'collection': 0.69; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'reply- to:addr:googlegroups.com': 0.74; 'andrea': 0.84; 'mechanism.': 0.84; 'moment)': 0.84
Newsgroups comp.lang.python
Date Fri, 2 Dec 2011 10:28:10 -0800 (PST)
In-Reply-To <mailman.3088.1322480760.27778.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=1.168.133.35; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw
References <mailman.3088.1322480760.27778.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
MIME-Version 1.0
Subject Re: python 2.5 and ast
From 88888 Dihedral <dihedral88888@googlemail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To comp.lang.python@googlegroups.com
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>
Message-ID <mailman.3233.1322850499.27778.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322850499 news.xs4all.nl 6894 [2001:888:2000:d::a6]:48302
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16563

Show key headers only | View raw


On Monday, November 28, 2011 7:45:57 PM UTC+8, Andrea Crotti wrote:
> I'm happily using the ast module to analyze some code,
> but my scripts need also to run unfortunately on python 2.5
> 
> The _ast was there already, but the ast helpers not yet.
> Is it ok if I just copy over the source from the ast helpers in my code base
> or is there a smarter way?
> (I don't even need all of them, just "parse" and NodeVisitor at the moment)

Sounds like a hash for nodes and a hash for a tree. 
A hash can replace a tree of finite number of nodes. 
An array or list is enough to replace a tree of finite number of nodes.

The heap sort ordering is simple but illustrative . 

After all the tasks  of the tree are done, the hash of the tree 
will be deleted by Python's garbage collection mechanism. 

A hash can replace an indexed array with (k,v) pairs for k=0,1,2,3...n in 
a trivial way.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

python 2.5 and ast Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-11-28 11:45 +0000
  Re: python 2.5 and ast 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-02 10:28 -0800
    Re: python 2.5 and ast Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-02 11:43 -0700
  Re: python 2.5 and ast 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-02 10:28 -0800

csiph-web