[Jan Gregor] > I want to apply changes in my source code without stopping jython > and JVM. Preferable are modifications directly to instances of > classes. My application is a desktop app using swing library. > > Python solutions also interest me. > > Solution similiar to "lisp way" is ideal.
OK, I'll play 20 questions with you. How close is the following to what you're thinking? begin SelfMod.java ------------------------------------------- //************************************************************ import org.python.util.PythonInterpreter; import org.python.core.*; class SelfMod { static String my_class_source = "class MyJyClass:\n" + " def hello(self):\n" + " print 'Hello World!'\n"; static String create_instance = "my_instance = MyJyClass()\n"; static String invoke_hello = "my_instance.hello()"; static String overwrite_meth = "def goodbye():\n"+ " print 'Goodbye world!'\n" + "\n" + "my_instance.hello = goodbye\n"; public static void main ( String args[] ) { PythonInterpreter interp = new PythonInterpreter(); interp.exec(my_class_source); interp.exec(create_instance); interp.exec(invoke_hello); interp.exec(overwrite_meth); interp.exec(invoke_hello); } } //************************************************************ end SelfMod.java --------------------------------------------- need-to-complete-my-coursework-for-telepathy-101-ly y'rs -- alan kennedy ------------------------------------------------------ email alan: http://xhaus.com/contact/alan -- http://mail.python.org/mailman/listinfo/python-list