Should I learn Python or Java?

Peter Hansen peter at engcorp.com
Sat Jan 6 23:54:30 EST 2001


Charlotte Williams wrote:
> 
> I notice that there is a lot of demand for Java programmers.  The only
> experience I have with an OO language is Smalltalk.   My questions are:
> 
> 1.  Which language would be best to learn, Java or Python.  

"Best" is of course dependent entirely on your own requirements.  
For me, Java was important to learn but at this point Python 
is hands-down the better (in terms of productivity, fun, and 
code quality).  Actually, I consider the three years between
my learning Java and my discovering and learning Python to
have been spent relatively ineffectively (using Java and Delphi).
My productivity is much higher with Python.  Based on 
what (little) I know of VB and VB programmers, I would have to 
say Python is definitely "better" for you.

> From a VB standpoint, which has the least learning curve?

Python.  No contest.  From a C++ background I took a week
to write my first sizable Java program.  I took about a week
to write my first sizable Python program too.  On the other
hand, for the former I was on vacation (geek!) and spent
about 14 hours a day on it.  The Python program was part 
time at work between other tasks...

(As far as reliability goes: with only minor tweaking both
programs are still in use.  The Java one has been running
as a 24x7 server since January 1997.  The Python one has
been in daily use as a factory test automation system since
May 2000.  I'm extremely happy with *both* languages' abilities
in this respect.)

> 2.  Is going from object-based to object-oriented programming that huge a
> jump?   I want to learn an OO language, however I plan on utilizing it in my
> career.

I wouldn't call it huge, but it *is* different.  Look at 
it as removing your training wheels, perhaps. :)

> 3. Which one is the most "fun" to program in?

Having spent similar amounts of time with both, I say 
Python wins convincingly.

> 4.  Is Python multi-platform?  How is it's performance compared to JAVA in
> an internet situation?  It's reliability?

Very multi-platform, although I consider Java similarly so.  
Performance "in an internet situation" is comparable, but 
then I would say C would be as well.... after all, "internet" 
and "bandwidth-limited" are synonymous, aren't they? :)  

(Going past that issue, though, I believe Java has an 
inherent potential advantage, but end only a small one 
[not like a factor of 2 or anything].  In the end, however, 
if I can write my Python code in half the time 
it takes to write Java code, I have lots more time to 
optimize, if I feel so inclined, compared to the Java 
code.  One could argue that makes Python faster...)

> 5.  Do you for see Python as becoming a major player like Java servlets and
> MTS?  

For me Python is already a "major player".  I never made it 
to servlets, but Zope (in Python) provides me with far more 
power than servlets looked like they would, for the cost.
(What's MTS?)

> Can you see Python demand outstripping Java demand in 2 years time?

Absolutely not.  Java has a very firm and, I believe,
deserved role in certain kinds of application, many 
involving server applications, especially mission critical 
ones.  Although Python, remarkable platform that it is, 
would perform admirably in even this area, it was _not_ 
designed for this kind of thing, and would _not_ be the 
best choice in many cases.  The right tool for the right job... 
for me, 20% of the time C is the right tool, 70% of the 
time it's Python, 10% it's Java, and 1% it's Assembly 
(note: this survey has a 1% margin of error, 19 times 
out of 20 ;-).

If those statistics applied to everyone, perhaps Python
demand would outstrip Java, but somehow I just don't
see that happening.  It seems to take a certain amount
of idealism in your blood to jump on board something
like Python.  Hmm.... I remember that being the case
with Java, in 1996, but perhaps all those Java people
have used up their idealism, or perhaps Guido just
can't compete against the Sun marketing machine...

Of course, there are people who still think Java
demand has yet to outstrip C++ demand, too.  I haven't
bothered watching either industry to see who's "winning".

> Many of these questions are in response to a post I saw earlier where Python
> was being touted as the next evolution of OO programming.  It went something
> like...
> C --> C++ --> Java --> Python.

Python is not an evolutionary advance beyond Java with 
respect to object-orientation.  Personally I do find it 
a _revolutionary_ advance beyond Java, in many other ways, 
but considering that Python came first, that's not entirely 
the right way to phrase it...  

Really, they are not exactly in direct competition with
each other, so looking at them as parallel evolutionary
paths might help.  One could say that although the Java 
genome has had recent strong success "replacing" the C++ 
genome which only a while ago replaced the C one, perhaps 
the environmental conditions are changing in such a way that 
they now favour the Python genome.

As with real-world evolutionary competition, biodiversity
is _essential_ to life.  Both Java and Python are likely 
to continue to encroach on the territories of other languages
as they demonstrate greater fitness in their evolutionary 
niches.



More information about the Python-list mailing list