[Python-3000] AST access (WAS: Adaptation vs. Generic Functions)

Robert Brewer fumanchu at amor.org
Mon Apr 10 05:30:22 CEST 2006


Guido van Rossum wrote:
> On 4/9/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> > Robert Brewer wrote:
> > > Part of the benefit of the bytecode-hacking is that
> > > your expression never has to be in a string.
> >
> > I'm wondering whether there should be some kind of
> > "code literal" syntax, where you write a Python
> > expression and the compiler transforms it as far
> > as the AST stage, then makes it available to the
> > program as an AST object.
> >
> > Or would that be too close to "programmable
> > syntax" for Guido's liking?
> 
> I'm more concerned about the choice of AST data structure
> and how it affects IronPython, PyPy, Jython and possible
> other Python implementations. I'd like to keep both the
> AST and the bytecode spec out of the language spec,
> otherwise those implementations will face the tough choice
> of either changing their parser technology to one that
> is probably less suited, or implementing two full parsers.

Not to mention cross-version issues with persisted AST objects or bytecode-sequences. When pickling my Expression objects, I chose to decompile them back into Python code for that reason. Although I had to upgrade the decompiler between 2.3 and 2.4 (to allow for the JUMP target changes, for example) I didn't have to upgrade a single saved Expression object.


Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20060409/2266d7a9/attachment.htm 


More information about the Python-3000 mailing list