Python Rocks!

Tim Peters tim_one at email.msn.com
Wed Jan 19 23:54:06 EST 2000


[Neel Krishnaswami]
> ...
> The only time indentation has been a problem for me is
> when using eval/exec, and encoding programs as strings
> is basically the wrong thing to do anyway. This fact has
> occasionally tempted me to write a PythonGen module along
> the same lines as Robin Friedrich's HTMLgen. It would make
> writing things like code walkers and program transformers
> much more elegant. It seems like an idea obvious enough
> that someone else must have beaten me to the punch, though.

Not that I've seen!  Programs-writing-programs is a twist of mind
conspicuously absent in the Python world.  Long before bytecodehacks,
Michael Hudson & I had some fun exchanging sick little program generators on
c.l.py, with the aim of pouring unreasonable effort into optimization.  You
can get Christian Tismer interested in this by implying he can't do better
<wink>, but nobody else plays this game here (Mike Fletcher gets close, but
stays on the sane side of the line <wink>).

Michael eventually scratched his itch more effectively with bytecodehacks,
which is evolving into a capable system for mucking with the soul of the
semantics (i.e., the Python VM), avoiding the surface syntax entirely.

If you want to pursue it, I bet you could whip up a powerful transformation
system quickly using John Aycock's SPARK framework (which supports tree
transformations via its very general parser -- see his docs for details).

when-programs-make-programs-next-thing-you-know-
    people-will-make-people-ly y'rs  - tim






More information about the Python-list mailing list