On 24/11/05, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Ed Singleton wrote:
> > Is it feasible to change a program's source code whilst it is running
> > without having to restart the program?  Is it feasible to get a
> > program to change it's own source code while it is running?
> >
> > For example, if you have a web server such as CherryPy that will
> > (hopefully) be running for months at a time and you want to be able to
> > change classes without having to restart the server.  Or if you want
> > to allow users of the site to edit a class through the web and see the
> > changes to the site immediately?
>
> This is hard. IIRC CherryPy has a way to automatically restart the server 
> when a module changes, which is not what you ask for but at least it is 
> automatic. A couple of recent threads on comp.lang.python have talked about 
> this:
>
> http://groups.google.com/group/comp.lang.python/browse_frm/thread/8bb4efbe726c4ab5/848860f76210be69
> http://groups.google.com/group/comp.lang.python/browse_frm/thread/7b34c30c5833a9b0/4ed71bb7c5a97b57
>
> Kent

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?

Ed
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to