Where is the latest step by step guide to use Jython to compile Python into Java?

Stefan Behnel stefan_ml at behnel.de
Mon Jun 4 11:27:28 EDT 2012


Narayanaswamy, Mohan, 04.06.2012 16:56:
> Python is dynanmic programming (but strongly typed), java is
> static-typed language.  Currently it is not possible to convert python
> into java, since python types are dynamically identified, not identified
> during compilation.

That's not entirely true. It's *possible* to translate Python to Java, just
like it's possible to translate Python to C or other statically typed
languages. That wouldn't be a 1:1 mapping from Python language constructs
into similar looking Java language constructs, simply because the Python
constructs tend to be more powerful and general, so there is no simple
direct mapping. But assuming sufficiently complex Java code, any Python
code can be translated to equivalent Java code.

Simple prove: Jython can execute Python code, and Jython is (at its basis)
written in Java. If you now collect all Java code that Jython executes
during the run of a Python program, you get pure Java code that is
equivalent to the Python program. Maybe not beautiful code, but definitely
Java code.

Stefan




More information about the Python-list mailing list