PC204 --- Frequently Asked Questions

What is Python anyway?

Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java. It is easy to learn and combines remarkable power with very clear syntax. The language has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. A small number of powerful high-level data types are built into the language. Python can be extended in a systematic fashion by adding new modules implemented in a compiled language such as C or C++. Such extension modules can define new functions and variables as well as new object types. Python is also usable as an extension language for applications that need a programmable interface. In addition, there are existing interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac, MFC). Because of this simple yet flexible framework, Python is well suited to both uncomplicated everyday programming tasks as well as large and complex programming projects.

Python's development was started in 1990 by Guido van Rossum at the National Research Institute for Mathematics and Computer Science (CWI) in the Netherlands, and continues as an Open Source Initiative project. Python is available for virtually every type of computer in existence today, from personal PCs to mainframe supercomputers. Because of its widespread availability, and because it is easy to learn as someone's first programming language and yet powerful enough to accomplish large and complex tasks, the popularity of Python has grown rapidly. It is now taught extensively as a "first-time" programming language, and there is an EDU special interest group that serves the common needs of the Python-in-education community.

Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception. When the program doesn't catch the exception, the interpreter prints a stack trace. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python's introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.

[Portions of the above text were excerpted from the www.python.org web site.]

Where do I get Python?

Python is available from www.python.org. New versions are released regularily. For this year's PC204 course, we'll rely on language features found in release 2.1.1 or later. You can download for free a version of Python for your personal computer from here. If you have trouble installing Python on your computer, send e-mail to conrad@cgl.ucsf.edu and ask for help.

Newer versions of Python now include IDLE, an Integrated DeveLopment Environment for Python. This makes it easy for users to type in and save their programs without the need of a separate text editor. If you're using Windows, you'll find IDLE under Start -> Programs -> Python -> IDLE. (Other systems vary.) Documentation for IDLE can be found here.

What if I don't have my own computer?

If you don't have a personal computer onto which can install your own version of Python and IDLE, you have two options. You can either use one of the PCs in the Library's Interactive Learning Center (ILC), or you can get an account on a UNIX computer system that the Resource for Biocomputing, Visualization, and Informatics (RBVI) maintains for this purpose.

Windows computers for use by PC204 students are available in the Interactive Learning Center (room 231) in Row A, seats A7, A8, and A9. These computers have had Python and IDLE pre-installed on them. The computers are available whenever the library is open, see scheduled hours for details. Students will need a code to unlock the door after 6 PM Monday - Friday, and all day Saturday - Sunday. Graduate Division students may ask for their door code at the Library Circulation Desk. Send e-mail to tef@cgl.ucsf.edu to request the PC204 account name and password that have been set up on these computers.

If you prefer to develop your Python programs on UNIX, the RBVI has a UNIX system known as "socrates.cgl.ucsf.edu" for this purpose. Send e-mail to tef@cgl.ucsf.edu to request that a socrates account be created for you (in lieu of a PC account). Note that since socrates is a UNIX system, so you'll need to know your way around UNIX in order to accomplish useful work. Instruction in UNIX fundamentals is beyond the scope of this course, but there are a wealth of good books available; see this list of auxiliary reference materials for additional information.

The best way to access host socrates is via the campus network, using either a PC or Macintosh computer in your lab, or by using one of the personal computers located in the Interactive Learning Center (ILC) on the second floor of the campus library or the ILC in room S-165. You'll need to use an application that supports the "telnet" or "secure shell (SSH)" communications protocol. One such program is "NCSA Telnet", a public domain application that works well on both Macintoshes and PCs. However, a better recommendation is to use a SSH client application, as this provides substantially more security than Telnet (see more on this below). "F-Secure" is now licensed on a site-wide basis at UCSF, and hence is available for free for UCSF users.

As noted above, telnet is considered an insecure communications protocol. For example, it is possible for an intruder/hacker to capture network traffic from the UCSF campus network, discover a user's login id and password, and thereby gain unauthorized access to a user's account. In order to prevent such unauthorized snooping on the UCSF network (or any computer network, for that matter), a secure communications protocol was devised that encrypts all network traffic so that login ids and passwords are hidden. This secure protocol is known as "SSH" and it's use is gradually becoming more widespread at UCSF and elsewhere. It may prove useful for you to read about the enhanced security measures in place at such UCSF facilities as the Computer Graphics Laboratory. For additional information on SSH, including links to free versions that anyone can download via the Internet, see this SSH tutorial.

 

Think we should have covered an important PC204 topic that we didn't? Just send e-mail to tef@cgl.ucsf.edu or conrad@cgl.ucsf.edu and let us know what we've forgotten. We'll be happy to add to this list.