Jython and super_reload?

Ype Kingma ykingma at accessforall.nl
Thu Aug 19 09:37:08 CEST 2004


Dave Benjamin wrote:

> There have been several discussions here about how to write a reload()
> function that works for classes as well as modules:
> 
> http://groups.google.com
groups?sourceid=mozclient&ie=utf-8&oe=utf-8&q=super_reload
> 
> I have been trying to come up with a solution that works for Jython, and
so
> far nothing has worked. I was wondering if anyone has attempted or
succeeded
> in writing such a function for Jython.

This works for classes: 

http://www.jython.org/docs/jreload.html

You can unload a module in Jython by removing it from sys.modules,
and (off course) by removing all other references to it.

To be sure about what happens you can tell the JVM to be verbose
about garbage collection of Java classes, and explicitly call
java.lang.System.gc() in some test scripts.


Ype




More information about the Python-list mailing list