Modifying running code? [HACK ALERT]

Stefan Boiadjiev stefanb at mail.vega.bg
Wed Dec 13 17:55:12 CET 2000


hi,

that is one of the features that is missing in the Python in comparison to
Smalltalk.
Smalltalk implementation of this is easier because it deals with 'image' where
resides an actual code, not with files as in Python and in Smalltalk you can
resume from the exception point.

This modifying running code can be used not only to debug but even to develop
some code - imagine that you develop initially only classes and method names
and then on the fly fill the methods with proper code :)
hth
Stefan Boiadjiev

Bjoern Giesler wrote:

> Hi,
>
> I'm writing a kind of mini runtime environment that lets me debug / correct
> buggy Python code "on the fly". This is supposed to work as follows:
>
> 1) an exception gets thrown by the buggy code and is caught by a toplevel
> exception handler
>
> 2) the toplevel handler figures out the function that caused the exception
>
> 3) the function source is loaded into an editor and can be corrected by the
> user
>
> 4) if the code has been saved, it is recompiled and inserted instead of the
> original function
>
> 5) the program is then resumed at the point where the original function had
> been called
>
> Can this be done in Python at all? Can it be done in regular Python or only
> in Stackless Python (which supports continuations and would therefore, I
> believe, make step 5 easy)? Is the whole thing complete bull doodoo? Any
> hints or suggestions?
>
> Thanks in advance for any input,
>                 --Björn




More information about the Python-list mailing list