In December 2008, Python 3.0 (a.k.a. "Python 3000" or "Py3k") was released. This release is incompatible with previous releases. Though it is somewhat more elegant than previous versions, we will not use it this term. Instead we'll use older versions such as 2.6 which are still in common use (and installed in the labs).
Tutorials, references, and links kan be found at http://www.python.org.
An excellent starting point is the Python Tutorial by Guido van Rossum.
>>> type(2) <type 'int'>If we declare a class C and create an instance c as shown below, type() will give rather general information:
>>> class C: pass >>> c=C() >>> type(C) <type 'classobj'> >>> type(c) <type 'instance'>
>>> isinstance(c, C) TrueThis will evaluate to True if c is an instance of class C or any of C's sub-classes.
In recent versions of Python, it is possible to test for basic types with isinstance as in isinstance(1,int), isinstance(1.2,float), isinstance((2,3),tuple), isinstance([3,4],list) and isinstance([1,2],list).
enscript -Whtml -Epython --color code.py -o code.html
pydoc -w code
A simple editor (with Python syntax hightlighting) should be sufficient for the simple assignments for this course.
A plethora of tools is available. In COMP 304 we focus on the "essence" of OO design and build only relatively small designs. For these reasons, using a huge, sophisticated tool may (1) take a long time to learn and (2) distract from the "essence" of the problem.
Some useful tools:
You must work in a team of exactly two people (for some of the assignments). Previous experience has shown that after the initial transient chaos of finding a partner, this works really well. Try to find a team partner after class or by sending a message to the entire class on WebCT. Remember that "pair programming" requires you to actually work together (same place, same time). You may form different teams for different assignments.
Hans Vangheluwe, Winter Term 2009.