fairly large webapp: from Java to Python. experiences?

Kent Johnson kent at kentsjohnson.com
Mon Feb 6 08:14:13 EST 2006


Fabio Zadrozny wrote:
> I agree that python code is usually smaller... but what you did is too 
> unfair (the code below would be more suitable for the comparrison).
> 
> python:
> print "%10.2f" % 10
> 
> java:
> System.out.println(String.format("%10.2f", 10.0));

Though String.format() is new in Java 1.5 so in older code or for 
backward compatibility the longer code may be found. OTOH Python has 
supported % formatting since at least version 1.4 released in 1996.
http://www.python.org/doc/1.4/lib/node11.html#SECTION00315100000000000000

In my experience the original point is valid - Python is usually 
(always?) more concise than equivalent Java code, and often dramatically 
so. Python makes common operations easy; Java sometimes seems to go out 
of its way to make them awkward.

Kent



More information about the Python-list mailing list