[Edu-sig] Reloading code (was Re: OLPC: first thoughts)

Michael Spencer mahs at telcopartners.com
Mon Mar 12 00:22:02 CET 2007

Paul D. Fernhout <pdfernhout <at> kurtz-fernhout.com> writes:

> This xreload module Guido supplies is similar to the approach I used for 
> Jython in my earlier link.
> http://www.arcknowledge.com/gmane.comp.lang.jython.user/2006-01/msg00023.html
> If you look at that thread, I acknowledge Michael Spencer as having 
> supplied some of the more sophisticated reload logic which is similar to 
> what Guido has posted here (not sure where Michael got it from of course, 
> nor where Guido got xreload from). See Michael's first related post here:
> http://www.arcknowledge.com/gmane.comp.lang.jython.user/2006-01/msg00016.html

FWIW, I still tinker with the reloading issue from time to time, in pursuit of a
fully-interactive environment.  My latest module is at:
http://svn.brownspencer.com/pynote/trunk/Mupdaters.py.  It's not documented for
standalone use, but may contain some useful ideas, and I'd be happy to discuss
it if anyone were interested.

Incidentally, class bodies provide one of the hard problems for reloading.
Ideally, for reloading, one would execute the class body in a proxy of the
existing dict, as for modules, but this can't be achieved with the same exec
<modulecode> in <proxyofexistingdict> approach.   In order to work-around this,
I wrote a pure-python compiler.  With this, it becomes possible to modify the
class definition bytecode to execute the class definitions in the existing class
dict rather than a new one.  The compiler itself is at:
http://svn.brownspencer.com/pycompiler/branches/new_ast/ .  However, I have not
yet connected it into the reloading module.


More information about the Edu-sig mailing list