This is a DeCal course offered in the Spring 2003 semester. It's the first course I've designed on my own, though I have some previous experience as a teaching assistant. Nonetheless, be prepared for a little experimentation and perhaps unconventional methods...
Short Description
This course will introduce you to the Python programming language from a design point of view, with an emphasis on practical ways to use Python to make your computer more useful to you. You'll learn about string processing, object-oriented programming, e-mail handling, and Web site scripting, while getting experience with good programming practices like code review, testing, debugging, and refactoring.
What is Python?
Python is an interpreted, object-oriented programming language that runs on just about any popular operating system. It has very clear syntax, provides useful high-level built-in types, and comes with a large and capable standard library. It is often compared to other languages such as Perl, Tcl, Scheme, or Java.
Target Audience
That would be you, I hope. You should have done some kind of programming before taking this course. We won't spend time explaining what it means to program a computer, though we'll quickly go over basic programming ideas as part of introducing how things are done in Python.
If you've taken a programming course before, the course probably taught Scheme (if you're lucky), or Java, or C, or C++ (if you're not so lucky). But do you ever write programs to save yourself time and effort, to get your computer to help you get things done? If you already write programs for yourself (or, say, a website), you might find that Python works better for some purposes. If you don't program for yourself, maybe that's because it's too much trouble to write programs, or to set up the language tools on your computer. Python will be a refreshing change: it's one of the easiest languages to use, to read, and to learn, and yet it gives you a lot of power. I hope this course will give you a new level of control over your computer and open up a range of possibilities for you to use it in new and productive ways.
If you've never written a program before, this course might not be for you. However, if you're technically inclined, keen, and willing to do some exploration on your own, talk to me about taking the course. (I personally think Python is the best choice of a first language for most people who want to learn how to program.)
Why would you want to learn Python?
- It's easy. Writing a Python program is one of the quickest ways to get your computer to do something for you. The syntax is simple, which makes it much easier to read and write than many other languages.
- It's powerful. Ten lines of Python can often do more than 30 lines of Java or 100 lines of C. (Scheme might be able to express more in ten lines than Python can, though most people would find Python easier to read than Scheme.) Python comes with a library of useful tools to take care of many common tasks, like downloading files or handling e-mail.
- It's effective. Lots of people use Python, even though it isn't marketed as heavily as Java or as widely known as Perl. Python is used extensively in many places, including Google, Yahoo, Infoseek, NASA, tons of startups, industry research labs, and national research labs like LANL and LLNL.
Coordinator
That would be me, Ping (pingzestyca). I've been using Python for a while now, and gotten to be friends with some of the nice Python folks. I'm here to help you. Please feel free to write to me with any questions you have about the course.
Enrollment
There are two sections, one for lower division and one for upper division, but they're the same course. In order to enroll, you must fill out the online survey and you must attend the first class. This is a 2-unit course, pass/no-pass.
Prerequisites
You should have done some sort of programming before. If you haven't, but you're really keen, have a technical mind, and an appetite for tinkering, talk to me about taking the course. If you aren't already comfortable with using a text editor (any editor is fine) or installing software on your computer, then this course probably isn't for you.
You will need to have a computer, or access to a computer account on campus (the OCF provides free computer accounts for Berkeley students). We won't require any special tools beyond Python and a text editor. You can download Python for your platform (Linux, MacOS, or Windows) at http://python.org/. If you are using Linux, Python is likely already installed; you can check by typing in the command "python".
Course Goals
Python is good for writing programs for yourself, and for other people. So these will be the two main goals. By the end of the course:
- You should be able to make your computer more useful to you, by automating simple tasks with Python programs.
- You should be comfortable having other people look at your code, and comfortable looking at code written by others.
Meetings
We'll meet weekly on Wednesdays from 4pm to 6pm in 320 Soda Hall. The first class will be on January 22. I really want to encourage you to get used to looking at code, so we'll spend the first part of each class reviewing and discussing everyone's work, and then the second part of the class teaching new material. I realize it may sound a little scary to have everyone looking at your work. Don't let that frighten you: I want you to get used to the idea (because that's what happens in real life), and come to be proud of what you write.
Assignments
There will be an assignment each week. Each assignment will be due at 6 pm on the Monday after it is assigned so that there is time to have them graded before the next class. You'll submit the assignments by e-mail. All of the work you do will be posted on this web site for other students to look at. The idea is that you'll have all weekend to do the assignment, I'll get them and post them on Monday, I'll grade them on Tuesday, and you'll have a day if you want to look at everyone's work before class on Wednesday.
There will also be a final project, which should result in a program that you can go on using after this course is over. I'll suggest some topics for final projects, but they're only ideas; I will be looking for project proposals from you by the eighth week of class (March 12).
Grading
Every assignment will get two grades: one for correctness, and one for readability. Not all the assignments will ask you to write a program; some will ask you to modify existing programs.
- Correctness: The assignment will get a check-plus if it's correct and at least a day early; a check if it's correct and on time; and a check-minus if it's late, incorrect, or doesn't work right.
- Readability: The assignment will get a check-plus if it's clear, concise, and easy to understand; a check if it's readable but could be improved; and a check-minus if it's unclear or hard to read.
A plus and minus cancel, leaving you with two checks. A missing assignment gets an X. Four pluses cancel an X. Assignments can be submitted late to turn any X into a check-minus. At the end of the semester, you must have no X's and fewer than six minuses in order to get a passing grade.
(This grading scheme is based on the one used by the Perl people. I owe my thanks to them.)
Resources
As we cover the Python language itself, we'll follow a textbook called "How to Think Like a Computer Scientist". Fortunately, the entire book is freely available online. You can also buy this book if you want a printed copy.
After we've covered the language, we'll talk about the standard library to get you familiar with the tools it provides for you. We won't be using a book for this part.
Here are some links to other information and books that you might want to look at:
- Python Documentation Online
- Learning Python, by Mark Lutz and David Ascher
- Python Cookbook (or browse the recipes online)