Python AST as XML
paul at boddie.org.uk
Tue Nov 2 17:00:19 CET 2004
Andy Dingley <dingbat at codesmiths.com> wrote in message news:<3sg1o0djs6u5o055pvu88610n5k5498i1q at 4ax.com>...
> On 27 Oct 2004 23:09:02 -0700, olepar at gmail.com (Oleg Paraschenko)
> >maybe of some interest:
> Maybe 5 years ago, before we realised what a bad idea it was.
Actually, it's something I've considered before myself, and there are
apparently various extensions to GCC (the compiler suite, not just the
C compiler) which support similar concepts, so I suppose it's the
royal "we" you're using.
> >XML can be considered as an external representation of in-memory
> >tree-like structures,
> Yes. But why would I want to ? XML is a clumsy _internal_
> representation and it's only useful as an external representation if
> you need some lowest-common-denominator more than you need a good and
> appropriate representation. The best external representation of
> Python is some Python source, not some over-abstracted XML version.
Unless you're writing tools in other languages. I personally find the
various Python modules for source code inspection to be adequate, but
you can't just import the compiler package in Java, for example.
> > and XML-related standards as methods of processing such data.
> XML-related protocols don't process data, they process an XML
> representation of that data. Their ability to do so is based on the
> XML aspect of it, not the underlying data model. This makes them
> somewhere between clumsy to develop wiith, or simply incapable of
> addressing the problem.
> "Lets make all our data standards interwork by using XSLT" was the
> theme of late '99. It didn't work.
It may not have worked in the royal court, but XSLT has lots of
interesting and productive uses provided you choose your problems
carefully. I can imagine that transforming various sections of Python
code (for simple macro implementations, for example) *is* one of those
problem areas in which XSLT can usefully be used. Moreover, by
choosing XML, the developer(s) have at least opened an area up to
various effective tools (including XSLT) which could not have been
readily used in that area before; that in itself suggests that the
project was worth undertaking, if only for the benefits subsequent
projects can derive from it.
More information about the Python-list