[Tutor] Modifying Source Code while Program is Running

Kent Johnson kent37 at tds.net
Thu Nov 24 17:44:56 CET 2005


Ed Singleton wrote:
> Hmmm, that's discouraging.  Do you know if it's feasible to just keep
> changes to code in memory synchronised with changes nto the source
> code?  So rather than reload source code, make sure that the source
> code reflects what is running in memory?
> 
> For example if your program is running, and you make a change to a
> class, is it possible to create the necessary class definition and
> save it to a file?

I think that would be hard too. How would you be making the changes to the class in the running program?

I guess you could have a metaclass that looks for changes to a class, decompiles it and writes the result to a file. Of course there would be no comments in the result, and I don't think there is a good free Python decompiler available...

Kent

-- 
http://www.kentsjohnson.com



More information about the Tutor mailing list