code is data

Paul Boddie paul at boddie.org.uk
Fri Jun 23 23:40:03 CEST 2006


Anton Vredegoor wrote:
> Paul Boddie wrote:
> >
> > I was going to write a long reply to one of your previous messages, but
> > the above link references a project which may intersect with some of
> > your expectations. Meanwhile, it should be noted that the availability
>
> Somehow I get the impression of getting away with my posts luckily,
> while you now are duping other interested readers into not reading your
> innermost feelings about this subject. Let's get it in the open, don't
> spare me :-)

I was just going to say that your Web application could have used XSLT
more or less exclusively if the data arrives in XML (and obviously
leaves in some kind of XML), provided you aren't doing exotic
processing on the data.

[...]

> Well maybe this trick of vehemently denying the existence of something
> on Usenet worked again, by materializing the thing as a reaction.

My intention was to correct the perception that before a bunch of work
was done on exposing the Python AST (the so-called "AST branch") there
weren't any tools to get nice ASTs which could be used to generate
code. Of course there are such tools, with the compiler module being in
the standard library itself - not to be confused with the parser module
which everyone seems to mention and about whose representation everyone
seems to complain, but that's also obviously in the standard library
too.

I'm not sure about the ready availability of Python-to-Python
transformers, though. I have made HTML "reports" of Python programs -
annotated source code with type information in CSS-based pop-ups - and
a plain text serialiser for the compiler module's AST wouldn't be as
difficult as that. The hardest part of working with the compiler API
would be in the modification of the AST, and perhaps it is in that area
that the "AST branch" shows promise.

[...]

> Maybe a Python webserver could also emit pieces of javascript code by
> getting them from a *Python* code library after translating Python
> code on the fly?

http://subway.python-hosting.com/file/crackajax/trunk/crackajax.py

I personally don't go for this kind of thing, but people have given it
some thought.

Paul




More information about the Python-list mailing list