These resources are the essentials for becoming productive using Python for statistical computing with astronomical data. The CASt/SAMSI Bayesian Astrostatistics Tutorials will introduce and rely on many of them.
This is Python's official home, where you'll find the current version of Python, documentation (in English, with some documentation in many other languages), and links to a wide variety of 3rd-party resources.
A handy summary of the Python language and several of the most-used library modules. Available for current and recent versions of Python, in HTML and PDF. Bookmark the HTML (either online or download a local copy).
A useful collection of programmer-submitted and user-rated "recipes" for accomplishing common tasks in Python. The numerical/scientific coverage is slim, but you will likely find yourself doing lots more than pure numerics with Python. O'Reilly publishes the best-rated recipes in their Python Cookbook.
The Python core language, though powerful, is simple in the sense of offering only a minimal amount of built-in functions. You provide additional functionality by writing your own Python scripts or modules, or by importing already existing modules. Python comes with a Standard Library of modules implementing a large amount of commonly needed functionality, such as access to system calls, string manipulations, basic math functions, internet protocol handling, etc.. If what you need isn't in the Standard Library, check the Cheese Shop (the name is a reference to a Monty Python skit), a categorized and searchable index to 3rd-party Python resources. A more feature-filled Python package distribution system is in the works.
The Vaults is another categorized and searchable index to 3rd-party Python resources. It predates the Cheese Shop, but remains useful.
This very active and helpful newsgroup is the place to go to get quick help from experts on issues not covered in the documentation. It is also where you'll find the latest news on Python developments, including announcements of new modules and discussion of upcoming enhancements to Python. Other sources of personalized expert support are the Special Interest Groups (SIGs). These groups maintain email discussion lists (archived on the web) devoted to such topics as MacOS platform-specific issues, Python in education, plotting and graphing, and image processing. See the Community page at the Python web site for more information about these and other community resources.
Here are places to go for help more specifically targeting Python's scientific computation capabilities. Bookmark the archive pages to search for answers to your questions; subscribe to lists you think will be regularly useful.
In a nutshell: Download a binary installer of Python for your platform from ActiveState's ActivePython site. Run it, which will install Python, some useful extra packages, and documentation. Then you'll have to install a handful of scientific computing packages from source (a fairly painless process thanks to Python's installation utilities). I've prepared separate instructions for Linux platforms and for Mac OS X. Further background and details:
There are a few good sources of Python distributions. The Download page at Python.org hosts the cross-platform source and points to binary distributions for many platforms; use the latest version (2.4.2 as of Jan 2006) if it is available for your platform.
Many Python users swear by ActiveState's ActivePython, a commercially maintained but free collection of binary installers for all the major platforms. An ActivePython installer installs the same Python you'd get from Python.org, but also includes a few commonly used 3rd party packages, and a collection of documentation, in formats tailored to your platform.
In addition, there is a Python implementation written in Java--Jython--which will allow you to use Python on any machine with a Java implementation. Jython gives you full access to Java's GUI capability from Python, but will not be able to run "standard" Python (aka CPython) code that uses Python extensions written in C, C++, or FORTRAN. This includes the numerical extensions we will use, so Jython is not suitable for the CASt/SAMSI tutorials. But it's good to know about if you do any cross-platform GUI programming.
Recommendation: Python's default GUI package is Tkinter, an interface to Tcl/Tk. If you anticipate running or writing Python GUI applications, be sure your machine has a recent Tcl/Tk version on it before you install Python so Python can include Tkinter. Python comes with a useful integrated development environment (editor/debugger) called IDLE that relies on the Tcl/Tk GUI package to implement its GUI elements; you will need a Tcl/Tk installation in order to use IDLE (and you may find IDLE to be a handy editor to use during the tutorials). Astronomers who are using NASA's FTOOLS package will likely have a version of Tcl/Tk already installed.
There are two closely linked Python packages facilitating scientific computing: NumPy and SciPy; both are hosted at SciPy.org (don't use the older www.scipy.org website, which reflects the now-obsolete version). NumPy implements fast array processing for Python, and supplements this with basic linear algebra, FFT, and random number generators optimized for use with NumPy arrays. SciPy builds further on NumPy, including large libraries of special functions, optimizers, signal processing tools, statistical methods, and other algorithms. You'll also need Matplotlib, a package that produces publication-quality 2-D plots that is closely integrated with NumPy/SciPy. For handling astronomical data in FITS files, you'll need the STScI numarray and PyFITS packages; their numdisplay package is also handy for displaying array data via the popular DS9 viewer.
NumPy/SciPy underwent a major metamorphosis just this month (Jan 2006), greatly improving the underpinnings of what was already a very productive scientific computing environment. Some quirks and bugs are likely still being sorted out as the changes propagate through these large packages. As a result, at the moment it is best to install "bleeding-edge" versions of these packages, checked out from the developer's SVN and CVS archives, and you'll likely have to install them from source. I am providing downloads and instructions for installing what you need for two platforms: Linux, and Mac OS X. (My apologies to Windows users; I don't use Windows for scientific computing and thus cannot support that platform for the Jan 2006 Python tutorials. Python, NumPy and SciPy are all very well supported for Windows, but you'll have to go elsewhere for help with installation.)
The Python interactive interpreter (invoked by typing "python" at a shell prompt) is sophisticated and more than adequate for interactive computing. However, there is an even better alterative, IPythonAn Enhanced Interactive Python. Invoked by typing "ipython", it provides all the features of the standard interpreter, plus easy history navigation, easy access to documentation, access to the shell, and many other features that make your Python prompt respond a bit like a Matlab or Mathematica prompt.
A frustrating shortcoming of Python's scientific computing
capability is the absence of self-contained
documentation, particularly an integrated basic introduction to all the
principal resources. This is being addressed, but in the meantime
you'll have to rely mostly on piecemeal documentation (the STScI document
below being a notable exception).
Here are some useful resources. But note that
these resources all predate the recent NumPy/SciPy changes;
where they refer to "Numeric" (an old Python array package),
you should now use "numpy" (the package name is lower case),
and you may come across a few incompatibilities between Numeric and numpy
syntax (there should be very few, by design).
For more detailed information, peruse the documentation resources at the SciPy and matplotlib web sites: SciPy Documentation, matplotlib Tutorial, matplotlib User's Guide (PDF), matplotlib "pylab" interface documentation, matplotlib Cookbook Wiki.
Print these and keep them handy.
These three documents are part of the official documentation; they are available in many formats (HTML, PDF, PostScript, etc.). I suggest you print them and bind them for quick reference, or bookmark the HTML versions. Here's what you'll find in each document:
The Python Tutorial by Python's inventor, Guido van Rossum, provides a quick but surprisingly thorough introduction to Python. There are many quick introductions to Python, but van Rossum's is the best I've yet come across for physical scientists already familiar with computing. You may also want to browse some of the other tutorials listed on the Introductor Material page at Python.org.
The Python Library Reference documents the large number of modules that come with the standard distribution. For scientific computing, the most-used information is in the first five chapters (though chapter 8 on "The Python Profiler" will also be useful if you need to fine-tune your code for performance). Print just these chapters; keep an electronic version of the whole reference handy in case you need other chapters. The first chapter documents important elements of Python's built-in capability; you should at least skim this chapter soon after you familiarize yourself with Python. Then skim the table of contents so you'll know where to find other information as the need arises.
The Python Language Reference provides a terse technical description of the language. It is not as useful as the other core documents and you needn't even crack its cover to start being productive with Python. But it will occassionally come in handy to help you understand some details of the language. In particular, in the likely event that you find yourself doing object-oriented programming with Python, you will find its coverage of "Special method names" (section 3.3) handy to help you make your custom Python classes implement standard behaviors.
Mentioned above, this terse summary of the language is indispensable. A shorter, bare-minimum reference is also available at O'Reilly's Python Quick Reference to Useful Commands.