Could Python supplant Java?

David Brown david at no.westcontrol.spam.com
Mon Aug 19 10:33:16 CEST 2002


> > But could Python do the trick? The python interpreter is smaller than
the
> > JRE, and it's certainly a nicely structured language, with nearly all
the
> > coding features of Java.
>
> Doesn't matter how "elegant" (or "structured" or "orthogonal") a language
> is.  Unless it has libraries that can be used to give users a valuable
> experience its worthless.
>

Actually, it does matter, especially for an open-source developed language
like Python.  One of the reasons it matters is precisely that it will affect
the quality and quantity of libraries available.  People who have the choice
of their language (as is the case for many open-source coders) will choose a
more "elegant" language over a less elegant language.  This is especially
true of good programmers with long experiance, rather than those whose
training consisted of reading "C for dummies".  The point here is that the
people writing the libraries are more experianced at it and can produce
something with a better designed interface (this is really the key point for
a library - the efficiency of the implementation is much less important as
long as it works).

And regarding the libraries - yes, Python has heaps of libraries available.
There are also plenty of ways to make use of external libraries in other
languages - many of Python's libraries are wrappers around C libraries
(giving you the power of a Python interface combined with the speed of a
native code library).

> From a User's perspective, what does Python give us that is new or
> different?
>

Well, that's easiest to see by comparing it to Java, since they have similar
targets as cross-platform languages.

Benifits:
    1) It is interpreted, making testing and debugging extremly easy.
    2) You can call the interpreter within a program - making it easy to add
extensions or macros to your program.
    3) It has the essential functional-programming constructs available,
which can be used to write very elegant code for some problems.
    4) It has a range of high-level datatypes such as lists and
dictionaries.
    5) The use of "__" for hiding private members is genial - users of a
class can access private members if they really *really* have to, without
making them fully visible to everyone else.  In stricter languages like C++
or Java, class members typically start of private but get changed to being
public during development when it turns out that they are needed externally.
With python, interfaces can be designed neatly and stay neat.
    6) It is a language designed by a mathematician to be suitable for
writing programs that are easily understandable, and easy to write
correctly.
    7) Python is run by Guido van Rossum, its Benevolent Dictator for Life.
Java is run by comittee for the benifit of a company.  There can be no doubt
that the BDFL is a more efficient way to run a large development project,
and Python is improved and extended regularly without losing sight of its
aims.

Disadvantages:
    1) It is slower than Java at running its bytecode (it has to do more
work), so if you are looking for fast execution you have to be careful of
your coding style so that you make best use of the implicit libraries.
    2) It is not yet as wide-spread as Java.

Differences, which may be advantages or disadvantages depending on your
viewpoint:
    1) Python uses white space and indentation for block scope delimiting.
This leads to far more readable programs, since you have no choice but to
format the code nicely.  Some people love this, some hate it.
    2) Java has strongly typed variables that are declared before use,
Python has run-time typing and variables are defined as needed.  Each system
has its advantages and disadvantages.








More information about the Python-list mailing list