CS9H - Python
Note to Readers
You are NOT required to do any of the following things, but you may find them useful in the course of getting acquainted with Python.
Practicing Python
There's many ways to get better acquainted with Python. If you like puzzles and/or math, then there's two ideal resources for you:
The Python
Challenge is a series of riddles that can be solved with
(usually short) Python scripts.
Project Euler is for the more
mathematically inclined and consists of a ever-growing set of problems
that will probably test your problem solving skills much more than your
programming skills. Nonetheless, if you need an excuse for programming,
and this is your type of thing, then you should have fun.
Documenting your code with Epydoc
If you've started programming in Python you've probably noticed that you can comment your code in about a million ways. If this bothers you and you want a standard way of doing it, this tip's for you. You can say goodbye to playground taunts about poorly commented code.
First, if you don't know what a docstring is and how it's useful, look at this.
Enter epydoc. From the website: "Epydoc is a tool for generating API documentation for Python modules, based on their docstrings." It simply means that epydoc is really a program that goes through your Python code, reads your (soon to be) lovely documentation, and spits out HTML files that nicely summarize everything to be found in there. That feature is probably not so important to you. The more important thing is that epydoc enforces a style of commenting that is nice, readable, and hopefully makes you feel better about your code.
If you want to see what epydoc documentation looks like, see this.
You can find a list of fields you can use to document things here.
How do you style your Python code in general? Like this.
Using setuptools to install Python packages
Setuptools comes with a program called 'easy_install' that makes installing Python modules really simple (as its name suggests). It connects to a repository of Python packages at http://pypi.python.org/pypi.
What kind of packages might you want to install? Well, for starters, the ipython shell (see below) can be installed with it. If you plan on doing anything more with Python than this class, then you will probably use easy_install very often.
You can find more details here:
Info and how to
install
Some
more install instructions and usage explanation
You don't NEED this for 9H, so if it seems like more trouble than it's worth, it probably is.
Using the IPython shell as a Python shell replacement
ipython is really worth using if even just for the colors. How is it different from the regular python shell? The short answer is that it makes your life easier and prettier. See this for a really quick walkthrough of ipython's features.
You can find more details here:
Official site download/install instructions
Official site documentation
In-depth Tutorial
Small Tutorial
It isn't necessary to have setuptools to install ipython, although it's only a command away if you do. You can simply download and install it directly.

selfpace AT cs DOT berkeley DOT edu
Hours for Fall
TUTOR TIPS