On Sep 1, 12:29 pm, Kristopher Micinski <[email protected]> wrote: > Fair enough, sorry, I didn't mean to sound brush-offy. Is there not > another python source to source compiler. > > Kris
I have searched and have not found any other Python source to Java source compiler. My guess is that it's not practical to implement something like this as a general solution so nobody has bothered to. I do not intend to make a general purpose Python to Java converter, it will be only for a very restricted set of Python semantics and will require that in Python code you import from java namespace. I do not intend to make any Python standard library available. I hope my intention here makes sense. For example, take a look at this file: https://bitbucket.org/eukreign/py2j/src/7c04466f0123/samples/fib.py Then the generated java code for that Test class: https://bitbucket.org/eukreign/py2j/src/7c04466f0123/samples/fib/Test.java To make the fib.py work in python there is this: https://bitbucket.org/eukreign/py2j/src/7c04466f0123/lib/junit/framework/__init__.py I will do the same sort of thing for any Java API that I would want unit testable from Python. When py2j runs on a .py file and it starts importing packages, if it sees that something is annotated with @java.Class() it will assume that this exists in the Java world and thus will leave the import statement "junit.framework.TestCase" but will no convert any classes. In other words, from Python you would have to access the Java API and a layer would exist to mimick the java functionality in Python (it would go in that lib directory). I will write some scripts to generate the entire Android API and actually implement any methods that would be useful for unit testing. Built-in python methods like string.replace() or len(), etc I would re- implement in Java so that the semantics would translate over directly. My other goal is to make the generated Java code actually readable and so that you could pass it off as hand written to some extent if you wanted :-) - lex -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

