convert python to java code

Magnus Lie Hetland mlh at
Mon Jan 7 23:01:40 CET 2002

In article <3c3a05aa at>, Gordon Hollenbeck wrote:
>> For actual use, of course, the .class compiled JVM-bytecode file is
>> all you need, and your maintenance will be on the .py source anyway.
>Well, the project is written in Java by all the other Java coders (all
>source is .java files).
>I just want a faster way to code than putting in {'s...
>oh well, ill stick with java

Well, you could easily create a preprocessor yourself, if all you
need is some syntax simplification... Translating

  class Foobar(Babar):
      int frozzbozz(int x, String y):
          return 2


  class Foobar extends Babar {
      public int frozzbozz(int x, String y) {
	  return 2;

[Sorry if the indentation got messed up here; having problems with
my editor :P]

is pretty easy with a little Python script. All you have to worry
about is handling indentation, which can be a bit tricky. I have
an old module for that lying about here:

I'm sure you can find ways of improving it :)

Good luck!

- Magnus (who has been thinking about creating simpler versions of
  Java and C/C++ himself...)

Magnus Lie Hetland                                  The Anygui Project                        

More information about the Python-list mailing list