10

Chapter 10

Defining Objects


Most bands start to suck the minute they learn how to play.

—Gary Burger, lead guitarist for The Monks

Figures

__str__ vs. __repr__
Figure 1.
now.py as a module
Figure 2.
Class now
Figure 3.
Running today.py
Figure 4.

Example Programs

There are three example programs for chapter 10 (now0.py is repeated from the last chapter):  download chapter10.zip.

  1. now0.py
  2. now.py
  3. today.py

Exercises

Download all the documentation for Python at http://www.python.org/doc/current/download.html.

If you prefer reading documentation online, go directly to http://www.python.org/doc/current/modindex.html.

Rewrite class today using the alternative implementation shown in Listing 10.3. Which style do you like better? Why?

You can find out more about the Royal Observatory at Greenwich (which no longer maintains an observatory at Greenwich, by the way) at http://www.rog.nmm.ac.uk/, and you can read about UTC at http://liftoff.msfc.nasa.gov/academy/rocket_sci/clocks/time-gmt.html, NASA’s Space Academy page.

You can find out about “Changing the Name of Arkansas” by tracking down Mack McCormick’s recording from Raglan, The Unexpurgated Folk Songs of Men. It’s out of print, sadly (and the record company is out of business), and it is not for the faint of heart.  And at http://comp.uark.edu/~sboss/hellno.htm, you will find a version of the famous speech.  It doesn’t match my recollection, but then, hardly anything does.

You can find out who The Monks are at http://www.the-monks.com/


Valid HTML 4.01 Transitional