[Edu-sig] Teaching Python instead of Java?

Jeffrey Elkner jeff@elkner.net
11 Mar 2001 17:26:42 -0500

Hi David!

Thanks for your interest in exploring Python as an introductory
programming language!
I am a high school teacher who has been using Python to teach our intro
course for
two years now.  I have never seen a better language for that purpose.

The main aim when teaching students to program is to give them an
of the processes of thought and the underlying concepts used in getting
a machine
to follow their will.  This is a daunting task, and no programming
language could
make teaching students to think logically easy.

The best programming language in the world for teaching programming
would be one
that does not add any additional overhead to the problem of teaching
students to
understand variables, conditional branches, and loops.  As a Python
yourself I'm sure you will understand when I say that Python does that
better than
any other language I know of.

To be concrete about this, let's compare Python with Java.  I agree with
you that
Java is a fine language (and it is definite improvement over C++ for
but it can't compare with Python as a first language.  Visit:


and compare the Java version of "How to think like a computer scientist"
the Python version in terms of length of the code examples.  Here is
world from the Java version:

class Hello {

 // main: generate some simple output

 public static void main (String[] args) {
   System.out.println ("Hello, world.");

Here is the Python version:

print "Hello, world."

The important thing here is that Java syntax places a great deal of
extra requirements
on the learner before they can even begin to program.  This "syntactic
noise" gets
in the way of focusing on the problem at hand and makes it more
difficult to teach
programming concepts.  It also raises the bar of entry into learning
and limits those who can be successful at it.

Python is good as a teaching language for the very same reasons that you
are now using it to program, it permits you to focus on the problem at
and doesn't get in your way.

Finally, Python has another tremendous strength as an introductory
language.  It supports a large variety of programming styles very well.
It is
equally at home with proceedural programming and OOP.  This is very
for an introductory language.  One of the most interesting talks at the
conference that I just attended was Eric Raymond's discussion of how he
Python to create a new configuration language for the Linux kernel.
This was
a problem that he described as best being solved with a language like
and he was able to do it with Python.

Thanks again for your inquiry, and let me know if I can be of any
assistance to you.

jeff elkner
yorktown high school
arlington, va

On 11 Mar 2001 12:49:30 +0100, David Pettersson wrote:
> Hi,
> I work as a teaching assistant at my local university, and we currently
> teach Java only to our new students (Pascal was left a couple of years ago).
> Although Java is a nice language, I still feel that it is inappropriate to
> teach new students (some of which have had no prior computer experience!).
> I have been using Python for a couple of years now, but it was far from my
> first language (although one could say it is my primary language now :).
> What I am wondering is if Python is a better alternative, and why if is so.
> Sincerely,
> -- 
> David Pettersson                                   Stardate [-30]6312.44
> dave@se.linux.org                        Public key available on request