__str__ vs. __repr__

Fredrik Lundh fredrik at pythonware.com
Sat Nov 13 13:01:24 CET 1999

M.-A. Lemburg <mal at lemburg.com> wrote:
> > You may be wondering how this works. The answer is that Viperi does not
> > use bytecode, it executes the 'Abstract Syntax Tree' directly.
> > Consequently, the original code can be recovered. (without comments,
> > or the original formatting, of course).
> Could you point me to some resources ? Using ASTs for execution
> is an interesting subject and I would like to know how you deal
> with Python dynamic nature in this context (are the ASTs self
> modifying ?).

guess my brain doesn't work well today,
but maybe someone could tell me:

1) what's the reason AST's would have to change during
the execution of dynamic code (the byte code doesn't
exactly change, does it?)

2) what's the reason byte code cannot be used to recover
the original source code (Swedish readers may remember
the ABC80, which did exactly this).


More information about the Python-list mailing list