CSCI A290/A590 Adventures in Computing

Introduction to the Python scripting language with Internet applications

Second Eight Weeks, Spring 2008

Syllabus (subject to change)

Overview

Python is a scripting (dynamically typed) language that is rapidly growing in popularity because it is exceptionally simple, fun to use, and powerful for a variety of applications. This short course provides an introduction to Python, with an emphasis on Internet applications. A semester of programming, or equivalent experience, is expected.

Application areas, selected in accord with the interests and abilities of the class, include possibilities such as:

  • string-based data mining
  • XML-based data mining
  • IRC server
  • CGI web page generation
  • simple database support for dynamic web page content
  • web development frameworks
  • content syndication
  • GUI development
  • Game frameworks
  • Programming utilities

Class time includes supervised individual and team program development, technical presentations, and project reports.

Instructor: Prof. Chris Haynes, chaynes@indiana.edu, office LH230F, office phone 855-3376, home phone 336-3221 (business hours only, please), office hours Monday 1-3:30 and by appointment. Don't hesitate to contact me if you have any questions or concerns.

Credit hours: 1.5

Schedule: Second eight weeks (beginning March 4th), TR 7:15P-8:25P in LH115

Python is about you

Bill Venners: In the introduction to your "Why I Love Python" keynote [at the 9th International Python Conference], you said what you love the most is "Python is about you." How is Python about you?

Bruce Eckel: With every other language I've had to deal with, it's always felt like the designers were saying, "Yes, we're trying to make your life easier with this language, but these other things are more important." With Python, it has always felt like the designers were saying, "We're trying to make your life easier, and that's it. Making your life easier is the thing that we're not compromising on."

—from an "artima development" interview

Portfolios

  • Each student maintains a portfolio of their work, including Python programs that they have developed or contributed to.

  • Maintain your portfolio as a directory that you have access to in class. A working copy of all or the active part of your portfolio may be maintained on a flash drive, but it must be backed up after every few hours of work to a professionally-maintained server. You may wish to use your Oncourse A290 site drop box for this purpose.

  • If you are actively working on a team project, shared project material may be maintained as a separate directory to which all team members have access. This should be indicated in team member's individual portfolios. Copies of the team's final work should be included in each team member's final portfolio submission. Team project materials must also be maintained on a professionally-maintained server. Oncourse and SVN sites for team work management are available on request.

  • Include in your portfolio a plain-text log with at least weekly entries noting progress, difficulties, and questions.

  • Email log entries for the last week to me every Sunday or Monday with "A290 Log" in the message subject and the log text in the body (not as an attachment).

  • Short individual assignments may be required, but most work can be done in approved teams. In team work, individual contributions are to be clearly noted in code comments, documentation, and log entries, as appropriate.

  • Who was responsible in whole or part for each file in your portfolio must be indicated by a comment in the first line of the file and/or by a README file in the file's, or a parent, directory. If different individuals independently contributed substantial portions of a file, indicate with conspicuous comments who was responsible for what portions.

    You should be able to demonstrate reasonable understanding of any code that you claim to be responsible for (unless you have clearly indicated with comments that for some reason you do not understand a bit of code).

    If you indicate responsiblity for code, but it is clear from your lack of understanding of the code or other evidence that you are not responsible for it, you may be charged with academic misconduct. See the department's Statement on Academic Integrity, and ask if you have any doubt of how it may apply to you.

Evaluation

  • Portfolios are the primary basis for evaluation.
  • Factors considered in evaluation include (in no particular order):
    • Planning and pacing (avoid a last minute crunch!)
    • Sophistication of Python features and libraries that are understood and appropriately used
    • Style: ease of understanding and modifying code, including internal documentation. See the A201 Python Style Rules and Guidelines.
    • Quality of external documentation
    • Design creativity
    • Extent of functionality
    • Difficulty of functionality
  • Failure to submit more than one weekly log may significantly effect course evaluation.
  • Focused attention in class and reasonable effort outside of class is expected. Class participation is valued. Large amounts of effort outside of class (over 10 hours a week) is not expected, and is discouraged if it interferes with other course work.
  • Ability gained during the course and level of effort are primary considerations, not absolute level of ability (since the class includes students with widely varying prior experience).
  • You are strongly encouraged to make an appointment with me (or take advantage of office hours, including April 28th) for review of your portfolio any time prior to submission. This is an opportunity for evaluation and constructive feedback for improvement of your submission.
  • Portfolio submission: submit your portfolio as a zip (or other common archive format) file in the dropbox of your class Oncourse site. Any such file in your dropbox after April 25th will be taken to be your final submission. The no exceptions deadline is midnight, Wednesday, April 30th. Early submission is encouraged.

Python reference and tutorial materials

Online documentation and tutorial material should suffice in most cases. No printed text or reference materials is required, though some may be recommended for individual use. Any software required for personal machine use is free.

The Python Beginner's Guide page is a great place to look for online tutorials and documentation appropriate to your interests and abilities.

The Python Tutorial by Guido van Rossum, included in the documentation distributed with Python, is often quite detailed. It can still be very good reading if you just note the sections that aren't of immediate interest and skip them.

There are lots of Python tradebooks you might find valuable. Python in a Nutshell, 2nd Ed. is current and one of the best, and Learning Python is an old favorite of mine.

Unfortunately there are few Python textbooks (with lots of exercises), and none that I can recommend highly. Zelle's Python Programming: An Introduction to Computer Science is perhaps the best all-round, though I suggest skipping the limited and non-standard graphics material in chapter 5.

A few pages prepared for this course:

Other links of particular interest:

Some project and exercise ideas

  • My A201 course. The practice and review problems and assignments 4 on (with associated lab exercises) are recommended if you want some exercises and small warm-up projects. This class doesn't have access to the A201 Oncourse site, but I can provide solutions as needed.
    • Assignment 9, simple data mining, many students find especially rewarding.
    • Assignment 10, the war card game, is a nice introduction to lists and card game basics.
  • CGI programming, using the above links to get started
  • XML programming using the Amara toolkit
  • Games of all sorts
    • card games and dice games make nice exercises, or can be elaborated into projects
    • there are powerful Python frameworks (comprehensive libraries) for animated game creation
  • Django framework web development
  • Contribution to (or otherwise working with) any number of open source Python projects on the web
  • If there's any repetitive chore you find yourself doing with a computer, the changes are good you can automate it with a Python script
  • "Pet projects" of mine
    • improve the reStructured Text facility
    • implement a translator for an improved compact XML syntax, along the lines of SLIP
  • OLPC (One Laptop Per Child) programming, using one of the laptops or the operating system simulator

Python implementations

CPython is the standard implementation of Python, freely available for all major (and several other) operating systems, and installed on LH115 machines. Its interpreter and some libraries are written in the C language.

Other implementations of Python that deserve consideration for some purposes include:

  • PyPy: an experimental implementation of Python written entirely in Python and targeting a number of platforms.
  • IronPython: runs on the .NET framework, with full access to the .NET APIs and interoperability with a great many other languages supported by .NET (such as C# and Visual Basic). The new Silverlight plug-in allows IronPython, and a number of other languages, to be run client-side on major browsers, including Firefox.
  • Jython: an implemented in Java with full interoperability with Java APIs and programs. Unfortunately development has been very slow since its original author, Jim Hugunin, was hired by Microsoft to implement IronPython. (It is now at version 2.2, where CPython was five years ago.)

CPython programming environments

You may use whatever programming environment for Python development, but some are much more helpful than others. Of course a plain-text editor must be used: do not use a word processor. Some development environments to consider follow.

  • IDLE comes with the standard Python distribution, is easy to use, and is serviceable for small to medium size programs such as those in this course. It is mostly self-explanatory, but check out One Day of IDLE Toying if you'd like a short screen-shot tutorial to get started.
  • Emacs can be customized for a vast variety of uses, including Python programming using one of its python modes.
  • Eclipse is a very powerful integrated development environment for many languages, including Python with the pydev plugin.

Like other powerful tools, Emacs and Eclipse have substantial learning curves. If you are already familiar with and like using either one, you will probably want to use it (unless perhaps if you are working with team members who don't use it). Otherwise, IDLE is recommended. All three are installed on LH115 machines and are free downloads.

Let me know if you prefer to use another environment.