I can’t give you a direct answer because I usually go the other way… using java in jython but this might provide some help I know it talks about it.





From: jython-users-bounces@lists.sourceforge.net [mailto:jython-users-bounces@lists.sourceforge.net] On Behalf Of indian scorpio
Sent: Thursday, April 10, 2008 3:18 AM
To: jython-users@lists.sourceforge.net
Subject: [Jython-users] defining a function in jython when embedded in java


how can I define a function (not a 1 line function) in jython when embedded in java.
lets say a fibo

def fibo(n):
    if n < 2:
        return n
        return fibo(n - 1) + fibo(n - 2)

- i do not want to read a python file & use the function defined in it{

- i do not want to use lambda (i.e for 1 line functions){
         python.exec ( "adder = lambda n : n*n" );
         python.exec ( "print adder(5)" );


This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.