Essentials.
- Getting python. Download Python from the official site. Note that many
Unix/Linux distributions and all Mac OS X systems already have python
installed; try typing
python
in your command shell (Mac
users: open Applications » Utilities » Terminal.app).
- Windows-specific builds.
Windows users may instead want the ActivePython
distribution, which includes the
win32api
and related
Windows-native modules, as well as PythonWin, a passable DrScheme-style
(code-up-top, interpreter-on-bottom) IDE.
- Mac OS X. Mac users wishing to develop applications that
interface directly with the Cocoa APIs will want to install PyObjC, the
Python-to-Objective-C bridge. You'll also be able to use Xcode as your
Python IDE.
Tutorials & documentation.
- The best-written, most complete Python tutorial freely available is Dive Into Python, by Mark Pilgrim.
This friendly, knowledgeable tome touches on how (and what) to install,
basic syntax, OOP and modular programming, and some practical stuff like
XML/HTML/SOAP.
It's aimed at people with a little programming (or “scripting
language”) experience, but little to no exposure to Python.
Computer scientists and PHP jockeys should all be able to breeze through
it, and its only shortcoming is that it hasn't been updated for a couple
of years.
- The official Python documentation
site is always up-to-date, however. The so-called
tutorial is more of a
general reference to the language. A more detailed description of Python
syntax and modules is the library reference; in
particular you'll probably find yourself bookmarking the modules index (one-stop
shopping for all the built-in modules).
Talks.
- I gave a lecture to the Rice CS Club on 30-Nov
2006; the slides (with most of the animations removed) are here. Update: Here is the 2008 version, given to the
brand-new Rice course comp140.
- Caltech has a Python short
course, touching on scientific computing, UI programming, C
extensions, and OpenGL. Slides available online; updated 2000.
Reference cards and “cheat sheets.”
- I wanted to give out a single-sheet reference to Python at my CS Club lecture but, sadly, verbosity seems to plague
the creators of such documents (e.g., 1, 2,
3).
The only one that fit front-and-back of a single 8½×11" sheet
of paper was this one
by Jason Harper. The bad news: it only covers version 1.5.2 of the
language, almost 10 years old. The good news: it's all still valid (for
example, it refers to the
re
module and not
regex
).
Scientific computing.
- NumPy (previously “Numeric
Python”) is the basic scientific computing package. You can
download it from the SciPy site, which
is a broader clearinghouse for scientific computation in Python.
Those experienced with MATLAB may find the NumPy for MATLAB users
page helpful as well.
- MATLAB users may also be interested in matplotlib, a library that
provides MATLAB-style graphing capabilities to Python. At that page
you'll also find information about
pylab
, an interactive
Python prompt that can be used (somewhat) like interactive MATLAB.
- Graphviz’s “dot” files can be consumed and produced
with pydot.
- If gnuplot is more your style, see gnuplot.py.
- Graphics: PyOpenGL; Python Imaging Library
(2D image processing and output);
pygame (a nice cross-platform
display graphics API).