Performance java vs. python

Ant antroy at gmail.com
Wed May 20 15:40:19 EDT 2009


On May 20, 6:46 pm, namekuseijin <namekusei... at gmail.com> wrote:
> anyway, again, thanks for the laughs.

I'm a Java developer in my day job, and I use Jython for testing out
ideas and prototyping, due to the way Jython makes writing Java so
much easier... Those examples were spot on - things weren't much
simpler before generics, as you had casting going on everywhere. Not
to mention the nice primitive / object divide to add to the languages
complexity.

And the libraries in Java... Compare cat implementations:

# Python
fh = open("myfile.txt")

for line in fh:
    print line

// Java

...

BufferedReader reader = new BufferedReader(new FileReader
("myfile.txt"));
String line = reader.readLine();
while (line != null) {
    System.out.println(line);
}

...

And that's without all of the class/main method boilerplate or try
catch block required due to checked exceptions.

I've taught both Java and Python, and the latter is far easier to pick
up and run with, from both a syntactic point of view and in the use of
the libraries.





More information about the Python-list mailing list