making the Python case to my dept.
Thomas A. Bryan
tbryan at python.net
Sat Nov 6 05:00:35 EST 1999
William Ahern wrote:
> Could anybody suggest some substantive info to make the case (or not make it).
> Also, the department will need an IDE (Win95/Mac), so if anybody knows where to
> find one....
I discussed this with a CS student once. He thought that it was
better to start with a procedural (subset of a) strongly typed
language: Pascal, C, or a subset of Java or C++. He thought it a
bad idea to start with such a loosely typed language as Python.
His argument was essentially that students who first learned
Python would find it very difficult to understand why they had
to declare variables as a specific type, etc. Then again, that's
how both he and I started out programming (with Pascal).
I started to convince him otherwise. I think that it may be better
to introduce students to programming by letting them think about
problem decomposition and data type design. With Python, students
can be quickly introduced to basic concepts such as loops and
procedures. They can even probably work with user-defined objects
in their very first course. They could implement a tree structure
as nested Python lists, for example. They could be introduced to
objects in their first course if desired. For a student who has never
programmed before, having to mess with static types often seems
strange. It certainly slows down a course and gives students an
additional thing to deal with while their trying to learn to think
like a computer, decompose problems, design consistent interfaces,
encapsulate data, etc. Many of us forget how much there is to learn
in a beginning programming course after we've been programming for
Python also has a large library (like Java) so that students can be
assigned problems that *do* something very early in their courses.
Assignments aren't restricted to things like a four-function calculator
because students can lean on the library and start implementing more
realistic applications as/after they learn the fundamentals of
The interactive interpreter also enables students to test little
language features while they're programming. They can keep a window
with the interpreter running open while they enter the program source
code in another file. Then, if they can't remember the methods for
a list, they can do something like this
>>> L = 
['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
[1, [1, 2, 3]]
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: list.extend() argument must be a list
[1, [1, 2, 3], 4]
[1, [1, 2, 3], 4, 5, 6, 7]
>>> print L.append.__doc__
L.append(object) -- append object to end
>>> print L.extend.__doc__
L.extend(list) -- extend list by appending list elements
Unlike Perl or Tcl, programming in Python doesn't look so much different
from programming in C++ or Java. It wouldn't be too difficult to
transition from Python to either C++ or Java. It would be simple to
introduce the second language, too. For example, begin by motivating a
C++ course by explaining that unlike Python, their first language, C++
is compiled to a machine dependent executable. Explain that the point
to make a very fast executable. To permit the compiler to make
optimizations, programmers are required to help it out by telling it
"type" all the variables are. This is similar to Python types, except
that C++ variables can only (basically) hold one type during their
lifetime. The compiler must also resolve references at compile time.
Thus, the language gains speed by sacrificing some of Python's dynamic
features. Then again, the C++ compiler provides type safety and catches
a lot of bugs at compile time instead of at run time. C++ is also
for very large programs where you might want to guarantee that others
don't touch your object's implementation. C++ provides very strong
language features to separate an objects' implementations from their
interfaces. Explain why this separation is often a good thing.
The first half a day could then be a whirlwind intro to what C++
requires and provides. The point is that after a semester or two of
Python, students are hopefully competent programmers. They know
how to handle loops and write procedures. They've also worked with
objects and thought about the benefits of consistent interfaces and
seen the benefits of subclassing to specialize behavior. Thus, a
whirlwind introduction of C++ could show them objects and how
subclassing in C++ looks. The potentially difficult concepts of
object-oriented design were taught without the additional obstacles
presented by a language like C++ or Java. When learning C++, the
students would already understand the road map. They understand
objects; they would just be learning how objects fit in a statically
typed language. When they get annoyed with the rigidity of types,
they'll be happy to learn templates to gain some of the lost
> I know Python is being used on a broad range of applications.
> Complaints from students these days, a professor told me, is
> that the current language, Pascal, is outdated and doesn't
> have much applicability in the real world.
I thought Pascal was designed as a teaching language. It was meant
to make an introduction to programming more friendly than throwing
the students to something like C. Of course, some companies started
implementing in Pascal, but that wasn't the point. The point was
to start students with a language designed to make learning to
If they originally chose Pascal for this fact, then they may
like Python. Guido designed a language that would be simple
enough to teach everyone but powerful enough to implement real
applications. Go to the Python website to find a few links
to where Python's being used in the "real world."
Still, few people are knocking down my door for Python programmers
while there are plenty of jobs for C++/Java/Delphi programmers.
Then again, if there are plenty of jobs for Cobol programmers,
and I doubt that anyone would advocate starting the students with
that language. The point here is that professors shouldn't worry
about teaching students a critical job skill in their first CS class.
Do math majors or engineers learn their critical job skill's in their
first classes? No. They don't often go into the job market saying,
"I know calculus." The skills they learn in their senior classes
are the ones that get them the jobs (that and internships). The first
courses are there to lay a solid foundation. If the students don't
understand that, then they need to be told. Again, there are jobs
in distributed databases and CORBA, but I don't think either of these
topics are suitable for an intro course.
Python would probably make a good first language because that was
one of its design goals. Point the professors to the Python website
where they can read papers by Guido van Rossum, the language's
designer. Heck, Guido would probably be willing to correspond with
them about how the language would fit in their curriculum.
> I've seen all of the energy and spirit behind the Python community,
> and I can't fathom why any cash strapped organization would drop a
> few grand for something that is freely available on the internet.
Java is also freely available. Other companies would probably be
willing to waive some or all of the fees for student programming tools
if it guaranteed a whole graduating class would know their tools.
> I figure using Python would be a start to getting people to think
> outside of the Microsoft culture (for better or worse).
> Bill Ahern
> MIS, JINSA
Ah! Well, I assumed that you meant a CS department. I see that
you probably meant the MIS department...which also explains a
market-based Microsoft focus. I'm sure that any decent business
student must understand the risk of trusting a single supplier,
but I can see where the complaints about learning Pascal could
come from. I'm not sure how those same people would feel about
learning Python since there still isn't much hype about it.
A bonus for Python though is that it can be used to interface
Microsoft's COM components (thanks to Mark Hammond). For
scripting COM components, I'm sure professors would see the
advantage of using a well-designed language like Python instead
of the mess I hear Visual Basic is. If that doesn't satisfy
market-driven students, I don't know what will. There is also
a cross-platform Python IDE called Idle and a separate Windows
IDE called PythonWin.
Another argurment for Python is that there are many tasks for
which something like Java is overkill. That's where languages
like Python, Perl, Tcl, and Visual Basic fit. I think that it's
critical for students to know something about these languages
since I haven't been in any job where at least one of them is
not used. Of the languages listed above (of which I can only
claim to know Python and Perl), I'd say that only Python would
make a good introductory language. By starting with Python,
the department would simultaneously lay the foundations for
other programming courses and introduce students to the type
of language that is used as a "glue" language...something a
well-designed curriculum may address more fully in a later
Good luck. I'd love to hear that the department chose Python.
More information about the Python-list