On Aug 13, 2012 5:22 PM, "fwierzbi...@gmail.com" <fwierzbi...@gmail.com> wrote: > > On Mon, Aug 13, 2012 at 1:46 PM, Guido van Rossum <gu...@python.org> wrote: > > On Mon, Aug 13, 2012 at 1:05 PM, fwierzbi...@gmail.com > > <fwierzbi...@gmail.com> wrote: > >> On Mon, Aug 13, 2012 at 12:06 PM, Brett Cannon <br...@python.org> wrote: > >>>> I see nothing about ast possibly being CPython only. Should there be? > >>> > >>> > >>> Time to ask the other VMs what they are currently doing (the ast module came > >>> into existence in Python 2.6 so all the VMs should be answer the question > >>> since Jython is in alpha for 2.7 compatibility). > > > > [Jython] > >> 2.5+ contains an ast.py that I obsessively compared to CPython's 2.5 > >> ast.py. > > > > But CPython's ast.py contains very little code -- it's all done in ast.c. > What I did was dump a pretty print of the ast from Jython and CPython > for every file in Lib/* and diff the results with a script. I got the > differences down to a small number of minor variations. > > > Still, I'm glad you are actually considering this a cross-language > > feature, and I will gladly retract my warning. (Still, I don't know if > > it is subject to the usual backward compatibility constraints.) > I don't know if IronPython does the same though... we might want to > wait for them to respond. > > > It might be pure python for Jython, but it's not for CPython. > It's actually Java for us :) -- in fact the internal AST uses the > exact Java that is exposed from our _ast.py - which I've come to > regard as a mistake (though it was useful at the time). I want to do > the same obsessive diff game with 3.x but then probably separate out > our internal ast implementation (possibly making ast.py pure Python). > > BTW - is Python's internal AST exactly exposed by ast.py or is there a > separate internal AST implementation?
Direct. There is an AST grammar file that gets compiled into C and Python objects which are used by the compiler (c version) or exposed to users (Python version). > > -Frank
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com