Getting Started with Python

Mitchell L Model

Visiting Associate Professor, Computer Science

This page highlights some of the most immediately useful resources for starting to use Python. It also contains some Python Advocacy plus pointers to more. Specific attention is paid to using Python in an educational context.



Introductory Material on Python lists many books, papers, essays, tutorials, etc. beyond those mentioned on this page, many of which are excellent and well worth attention. Another very valuable site, The PythonInfo Wiki begins with a set of "getting started" links.

What is Python? Executive Summary is a concise description of Python and its main attractions by Python's creator, Guido von Rossum.

Python.org has a page of starting points for the clueless called Can't find what you're looking for?. If you don't find what you need on the present page that page would be a good place to look next. python.faqts is another page full of starting points, plus FAQs and other useful information. Search Python Resources provides a helpful form for searches restricted to various sources of Python information and resources.

Quick Start

If you're just looking to get a taste of Python and try it out on your computer, I suggest you do the following:

  1. Download and install Python
  2. Read one of the tutorials listed below. The one that comes with Python is very good (also available online). So is Dive into Python.
  3. Write some code.

Why Python?

Like Perl, Python is an all-purpose scripting and programming language. Nearly all reasons for using Perl apply as well to Python, but Python is much better as it does not subject its users to the kind of ugliness, complexity, and extreme subtlty that pervades Perl and Perl programs.

One of the most important reasons for using "scripting" languages is that they can be processed by interpreters, as opposed to compilers. As a result, the standard compile-link-load cycle is greatly abbreviated, debuggers can be used to interact with a program while it is running, testing is facilitated, and integrated development environments can be simpler yet more powerful because of the information they can easily extract from a program about its structure.

Another important reason to use "scripting" languages is that they don't enforce the rigors of "strong typing" of variables and subroutine arguments. (Perl, however, is something of a hybrid in this regard.) While this has drawbacks for the development of large-scale industrial- or military-grade software, it greatly facilitates development of small- to moderate-scale software.

For further information about Python see the following (among many other possibilities, some of which are mentioned elsewhere on this page):

Scripting Languages

Technically Python is classified as a scripting language, as are Perl, Tcl, and JavaScript. The term originated in the earliest days of the Unix culture (mid-70's) to describe small, special-purpose languages used to program sequences of "shell" (system) commands. Like all such efforts at small, special-purpose languages, these eventually grew to have much the same sorts of features and power as regular programming languages. Languages such as Perl and Python inherit some of their specific details from the Unix shell scripting tradition, but are really much more like regular programming languages. I'm not sure there is any longer any sense in distinguishing "scripting" from "programming" languages, but the fact remains that Perl and Python are still called scripting languages and files of Perl and Python code often called "scripts".

Here are a few things to read that describe and compare current scripting languages, including Python.

Python vs. Perl

Python is to Perl as Java is to C++ — and maybe more so. Perl is an untenable technology for serious software development. I don't care how much code is written in Perl: it's all hacks — often brilliant, but still hacks.

Python's community is very similar to Perl's, including its

Some comparisons of Python to Perl:

In the context of an (unfavorable) comparison of Ruby to Python noted C++ and Java author Bruce Eckel had this to say about his experience with Perl and Python: "I liked Perl for about 3 months, before discovering Perl objects and references and trying to read my own Perl code. I haven't looked back."

Python vs. Java and C++

C++ is a middle-level language, appropriate for serious systems programming (compilers, development environments, operating systems, servers, etc.). It shouldn't be used for anything else. It's widespread use for teaching and application programming is an historical accident, given that it's an extension of C whose widespread use for teaching and application programming was an historical accident and aberration. If you are thinking about Python for any reason, I can't imagine C++ being what you need. It's ugly, catankerous, devious, inconsistent, and dangerous; stay away!

Java, on the other hand, is a pretty nice high-level language. It eliminated much of C++'s complexity and inconsistencies, and it benefited from the lessons learned by people trying to use and deploy C++. On the other hand, its simplifications eliminate much of C++'s power too. Java is a pretty good language for almost any kind of programming; however, it's hard to think of a use for which it is a particularly good choice. Java's popularity is also something of an historical accident and the result of its widespread availability in a time of technical despair. Why use Python instead of Java? Write a few short programs in both and see if the answer isn't obvious.

Comparisons with Other Languages

Python for Education

There are three major educational contexts in which Python could be used: introductory programming courses, the full computer science curriculum, and programming for other (usually science) fields (especially "life sciences").

Python is an elegant, simple, easy to learn language. I can't think of a better "traditional" language for introducing programming. (I could, however, enthusiastically argue for even better non-traditional languages, such as Smalltalk and Lisp/Scheme.) Unlike some (supposedly) easy to learn languages from years past, Python is a fully-featured serious programming language, so that students who want to continue on to more sophisticated programming can do so using Python. Moreover, like Perl and java, it supports and provides easy to use interfaces for the complete range of Web languages, protocols, and technologies.

The following essays address the use of Python in education for various purposes at various levels:

The "Computer Programming for Everybody" project seems to be dormant now, but the vision expressed in its documents remains vital. How to Think Like a Computer Scientist : Learning with Python is the Python version of the original (and original) Java-based book by Allen B. Downey, professor of Computer Science at Wellesley College. Various versions of this book are available for reading and
download at The Open Book Project. The Python book's home page provides further information, including about buying physical copies.

Learning Python

Online Guides & Tutorials

You can find many more links to online Python help and tutorials at Google's directory of Python FAQs, help, and tutorials. Listed here are what I think are the most useful.

For beginners:

For programmers:

For life scientists with some programming experience:

Some special Python programming topics:

Books

Most Python books are available at the usual online and physical places to buy technical books. I particularly recommend Bookpool.com for its excellent service and lowest prices. The Python Bookstore – is an unusually well-organized site providing information about virtually every book published about Python; see, in particular, the General Introductions section.

As with many other topics, O'Reilly's books on Python are definitive and well-done. A complete list will be found under "Products" at O'Reilly's Python Center. The most generally useful ones are:

In addition to the O'Reilly books, the following are especially good:

Resources

Software

Python Distributions

Download Python from the following locations, depending on platform. On platforms not listed here, download the source distribution, gunzip and untar the file, change to the directory, and do configure followed by make.

In addition, Windows and Linux distributions are available from the main Python commercial tool vendors:

Additional Software, Tools, Etc.

The main sites for additional software, tools, and information are:

Some useful Python extensions for specific tools are:

Integrated Development Environments

The Python distribution includes a simple IDE written in Python, called IDLE. (Look at "One Day of IDLE Toying" to see it in action.) On Windows, an entry for IDLE is installed on the Python program submenu on the Start Menu. On Unix, it's just an executable. MacPython comes with its own IDE, which is a regular double-clickable application. There are also a few commercial IDE's, including:

A intermediate choice, which might well be best for most Windows users, is PythonWin, which is part of ActiveState's free ActivePython, mentioned above. A review of Python IDEs, while out of date, has some useful comments to make about these and other tools.

Community

The Python community has a gentle, open feel to it, with many mailing lists and web sites devoted to helping people use Python. Here are some the more important starting points:

Papers, Essays, & Presentations

Documentation


MitchellModel@mac.com
Last modified: Fri Nov 15 11:04:03 EST 2002 ÿ