Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
33 views

Python Programming An Introduction to Computer Science John M. Zelle pdf download

The document provides links to download various ebooks and textbooks, including 'Python Programming: An Introduction to Computer Science' by John M. Zelle. It lists several recommended titles along with their download links from ebookultra.com. The document also includes details about the content and structure of the Python programming book.

Uploaded by

bubergpeszt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Python Programming An Introduction to Computer Science John M. Zelle pdf download

The document provides links to download various ebooks and textbooks, including 'Python Programming: An Introduction to Computer Science' by John M. Zelle. It lists several recommended titles along with their download links from ebookultra.com. The document also includes details about the content and structure of the Python programming book.

Uploaded by

bubergpeszt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Download the full version and explore a variety of ebooks

or textbooks at https://ebookultra.com

Python Programming An Introduction to Computer


Science John M. Zelle

_____ Follow the link below to get your download now _____

https://ebookultra.com/download/python-programming-an-
introduction-to-computer-science-john-m-zelle/

Access ebookultra.com now to download high-quality


ebooks or textbooks
Here are some recommended products for you. Click the link to
download, or explore more at ebookultra.com

The Art Science of Java an introduction to computer


science 1st Edition Eric Roberts

https://ebookultra.com/download/the-art-science-of-java-an-
introduction-to-computer-science-1st-edition-eric-roberts/

Quantum Computer Science An Introduction 1st Edition N.


David Mermin

https://ebookultra.com/download/quantum-computer-science-an-
introduction-1st-edition-n-david-mermin/

Hack Audio An Introduction to Computer Programming and


Digital Signal Processing in MATLAB 2019th Edition Eric
Tarr
https://ebookultra.com/download/hack-audio-an-introduction-to-
computer-programming-and-digital-signal-processing-in-matlab-2019th-
edition-eric-tarr/

Basic Computation and Principles of Computer Programming


An Introduction to Computing WBUT 2015 4th Edition E.
Balagurusamy
https://ebookultra.com/download/basic-computation-and-principles-of-
computer-programming-an-introduction-to-computing-wbut-2015-4th-
edition-e-balagurusamy/
Introduction to Computing and Programming in Python a
Multimedia Approach Mark J. Guzdial

https://ebookultra.com/download/introduction-to-computing-and-
programming-in-python-a-multimedia-approach-mark-j-guzdial/

Systematic Theology An Introduction to Christian Belief


1st Edition John M. Frame

https://ebookultra.com/download/systematic-theology-an-introduction-
to-christian-belief-1st-edition-john-m-frame/

Introduction to Programming with Java 3rd Edition John


Dean

https://ebookultra.com/download/introduction-to-programming-with-
java-3rd-edition-john-dean/

Introduction to Python for Science and Engineering Second


Edition David J. Pine

https://ebookultra.com/download/introduction-to-python-for-science-
and-engineering-second-edition-david-j-pine/

A Computer Science Tapestry Exploring Programming and


Computer Science with C 2nd edition Owen L. Astrachan

https://ebookultra.com/download/a-computer-science-tapestry-exploring-
programming-and-computer-science-with-c-2nd-edition-owen-l-astrachan/
Python Programming An Introduction to Computer
Science John M. Zelle Digital Instant Download
Author(s): John M. Zelle
ISBN(s): 9781887902991, 1887902996
Edition: Pap/Cdr
File Details: PDF, 1.20 MB
Year: 2003
Language: english
Python Programming:
An Introduction to Computer Science

John M. Zelle, Ph.D.

Version 1.0rc2
Fall 2002
Copyright c 2002 by John M. Zelle

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without prior
written permission of the author.

This document was prepared with LATEX 2ε and reproduced by Wartburg College Printing Services.
Contents

1 Computers and Programs 1


1.1 The Universal Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Program Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 What is Computer Science? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Hardware Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 The Magic of Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 Inside a Python Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.8 Chaos and Computers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2 Writing Simple Programs 13


2.1 The Software Development Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2 Example Program: Temperature Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3 Elements of Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.1 Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.2 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4 Output Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 Assignment Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.5.1 Simple Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.5.2 Assigning Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.5.3 Simultaneous Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.6 Definite Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.7 Example Program: Future Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3 Computing with Numbers 25


3.1 Numeric Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2 Using the Math Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.3 Accumulating Results: Factorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.4 The Limits of Int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.5 Handling Large Numbers: Long Ints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.6 Type Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

4 Computing with Strings 39


4.1 The String Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2 Simple String Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3 Strings and Secret Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.3.1 String Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.3.2 Programming an Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.3.3 Programming a Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.3.4 Other String Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

i
ii CONTENTS

4.3.5 From Encoding to Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48


4.4 Output as String Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.4.1 Converting Numbers to Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.4.2 String Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.4.3 Better Change Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.5 File Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.5.1 Multi-Line Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.5.2 File Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.5.3 Example Program: Batch Usernames . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.5.4 Coming Attraction: Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

5 Objects and Graphics 61


5.1 The Object of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.2 Graphics Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3 Using Graphical Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.4 Graphing Future Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.5 Choosing Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.6 Interactive Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.6.1 Getting Mouse Clicks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.6.2 Handling Textual Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
5.7 Graphics Module Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.7.1 GraphWin Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.7.2 Graphics Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.7.3 Entry Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
5.7.4 Displaying Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
5.7.5 Generating Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
5.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

6 Defining Functions 85
6.1 The Function of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.2 Functions, Informally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.3 Future Value with a Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
6.4 Functions and Parameters: The Gory Details . . . . . . . . . . . . . . . . . . . . . . . . . . 90
6.5 Functions that Return Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
6.6 Functions and Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
6.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

7 Control Structures, Part 1 101


7.1 Simple Decisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
7.1.1 Example: Temperature Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
7.1.2 Forming Simple Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
7.1.3 Example: Conditional Program Execution . . . . . . . . . . . . . . . . . . . . . . . 104
7.2 Two-Way Decisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.3 Multi-Way Decisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
7.4 Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
7.5 Study in Design: Max of Three . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
7.5.1 Strategy 1: Compare Each to All . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
7.5.2 Strategy 2: Decision Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
7.5.3 Strategy 3: Sequential Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
7.5.4 Strategy 4: Use Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
7.5.5 Some Lessons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
7.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
CONTENTS iii

8 Control Structures, Part 2 119


8.1 For Loops: A Quick Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
8.2 Indefinite Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
8.3 Common Loop Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
8.3.1 Interactive Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
8.3.2 Sentinel Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
8.3.3 File Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
8.3.4 Nested Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
8.4 Computing with Booleans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
8.4.1 Boolean Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
8.4.2 Boolean Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
8.5 Other Common Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
8.5.1 Post-Test Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
8.5.2 Loop and a Half . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
8.5.3 Boolean Expressions as Decisions . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
8.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

9 Simulation and Design 137


9.1 Simulating Racquetball . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
9.1.1 A Simulation Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
9.1.2 Program Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
9.2 Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
9.3 Top-Down Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
9.3.1 Top-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
9.3.2 Separation of Concerns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
9.3.3 Second-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
9.3.4 Designing simNGames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
9.3.5 Third-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
9.3.6 Finishing Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
9.3.7 Summary of the Design Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
9.4 Bottom-Up Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
9.4.1 Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
9.4.2 Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
9.5 Other Design Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
9.5.1 Prototyping and Spiral Development . . . . . . . . . . . . . . . . . . . . . . . . . . 150
9.5.2 The Art of Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
9.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

10 Defining Classes 155


10.1 Quick Review of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
10.2 Example Program: Cannonball . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
10.2.1 Program Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
10.2.2 Designing the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
10.2.3 Modularizing the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
10.3 Defining New Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
10.3.1 Example: Multi-Sided Dice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
10.3.2 Example: The Projectile Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
10.4 Objects and Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
10.4.1 Encapsulating Useful Abstractions . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
10.4.2 Putting Classes in Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
10.5 Widget Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
10.5.1 Example Program: Dice Roller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
10.5.2 Building Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
10.5.3 Building Dice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
iv CONTENTS

10.5.4 The Main Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172


10.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

11 Data Collections 177


11.1 Example Problem: Simple Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
11.2 Applying Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
11.2.1 Lists are Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
11.2.2 Lists vs. Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
11.2.3 List Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
11.3 Statistics with Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
11.4 Combining Lists and Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
11.5 Case Study: Python Calculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
11.5.1 A Calculator as an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
11.5.2 Constructing the Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
11.5.3 Processing Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
11.6 Non-Sequential Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
11.6.1 Dictionary Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
11.6.2 Dictionary Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
11.6.3 Example Program: Word Frequency . . . . . . . . . . . . . . . . . . . . . . . . . . 194
11.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

12 Object-Oriented Design 201


12.1 The Process of OOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
12.2 Case Study: Racquetball Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
12.2.1 Candidate Objects and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
12.2.2 Implementing SimStats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
12.2.3 Implementing RBallGame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
12.2.4 Implementing Player . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
12.2.5 The Complete Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
12.3 Case Study: Dice Poker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
12.3.1 Program Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
12.3.2 Identifying Candidate Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
12.3.3 Implementing the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
12.3.4 A Text-Based UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
12.3.5 Developing a GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
12.4 OO Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
12.4.1 Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
12.4.2 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
12.4.3 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
12.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

13 Algorithm Analysis and Design 225


13.1 Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
13.1.1 A Simple Searching Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
13.1.2 Strategy 1: Linear Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
13.1.3 Strategy 2: Binary Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
13.1.4 Comparing Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
13.2 Recursive Problem-Solving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
13.2.1 Recursive Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
13.2.2 Recursive Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
13.2.3 Recursive Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
13.3 Sorting Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
13.3.1 Naive Sorting: Selection Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
13.3.2 Divide and Conquer: Merge Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
CONTENTS v

13.3.3 Comparing Sorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234


13.4 Hard Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
13.4.1 Towers of Hanoi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
13.4.2 The Halting Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
13.4.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
vi CONTENTS
Chapter 1

Computers and Programs

Almost everyone has used a computer at one time or another. Perhaps you have played computer games or
used a computer to write a paper or balance your checkbook. Computers are used to predict the weather,
design airplanes, make movies, run businesses, perform financial transactions, and control factories.
Have you ever stopped to wonder what exactly a computer is? How can one device perform so many
different tasks? These basic questions are the starting point for learning about computers and computer
programming.

1.1 The Universal Machine


A modern computer might be defined as “a machine that stores and manipulates information under the con-
trol of a changeable program.” There are two key elements to this definition. The first is that computers
are devices for manipulating information. This means that we can put information into a computer, and it
can transform the information into new, useful forms, and then output or display the information for our
interpretation.
Computers are not the only machines that manipulate information. When you use a simple calculator to
add up a column of numbers, you are entering information (the numbers) and the calculator is processing the
information to compute a running sum which is then displayed. Another simple example is a gas pump. As
you fill your tank, the pump uses certain inputs: the current price of gas per gallon and signals from a sensor
that reads the rate of gas flowing into your car. The pump transforms this input into information about how
much gas you took and how much money you owe.
We would not consider either the calculator or the gas pump as full-fledged computers, although modern
versions of these devices may actually contain embedded computers. They are different from computers in
that they are built to perform a single, specific task. This is where the second part of our definition comes into
the picture: computers operate under the control of a changeable program. What exactly does this mean?
A computer program is a detailed, step-by-step set of instructions telling a computer exactly what to do.
If we change the program, then the computer performs a different sequence of actions, and hence, performs
a different task. It is this flexibility that allows your PC to be at one moment a word processor, at the next
moment a financial planner, and later on, an arcade game. The machine stays the same, but the program
controlling the machine changes.
Every computer is just a machine for executing (carrying out) programs. There are many different kinds
of computers. You might be familiar with Macintoshes and PCs, but there are literally thousands of other
kinds of computers both real and theoretical. One of the remarkable discoveries of computer science is
the realization that all of these different computers have the same power; with suitable programming, each
computer can basically do all the things that any other computer can do. In this sense, the PC that you might
have sitting on your desk is really a universal machine. It can do anything you want it to, provided you can
describe the task to be accomplished in sufficient detail. Now that’s a powerful machine!

1
2 CHAPTER 1. COMPUTERS AND PROGRAMS

1.2 Program Power


You have already learned an important lesson of computing: Software (programs) rules the hardware (the
physical machine). It is the software that determines what any computer can do. Without programs, comput-
ers would just be expensive paperweights. The process of creating software is called programming, and that
is the main focus of this book.
Computer programming is a challenging activity. Good programming requires an ability to see the big
picture while paying attention to minute detail. Not everyone has the talent to become a first-class program-
mer, just as not everyone has the skills to be a professional athlete. However, virtually anyone can learn how
to program computers. With some patience and effort on your part, this book will help you to become a
programmer.
There are lots of good reasons to learn programming. Programming is a fundamental part of computer
science and is, therefore, important to anyone interested in becoming a computer professional. But others can
also benefit from the experience. Computers have become a commonplace tool in our society. Understanding
the strengths and limitations of this tool requires an understanding of programming. Non-programmers often
feel they are slaves of their computers. Programmers, however, are truly the masters. If you want to become
a more intelligent user of computers, then this book is for you.
Programming can also be loads of fun. It is an intellectually engaging activity that allows people to
express themselves through useful and sometimes remarkably beautiful creations. Believe it or not, many
people actually write computer programs as a hobby. Programming also develops valuable problem-solving
skills, especially the ability to analyze complex systems by reducing them to interactions of understandable
subsystems.
As you probably know, programmers are in great demand. More than a few liberal arts majors have turned
a couple computer programming classes into a lucrative career option. Computers are so commonplace in the
business world today that the ability to understand and program computers might just give you the edge over
your competition, regardless of your occupation.

1.3 What is Computer Science?


You might be surprised to learn that computer science is not the study of computers. A famous computer
scientist named Edsgar Dijkstra once quipped that computers are to computer science what telescopes are to
astronomy. The computer is an important tool in computer science, but it is not itself the object of study.
Since a computer can carry out any process that we can describe, the real question is What processes can we
describe? Put another way, the fundamental question of computer science is simply What can be computed?
Computer scientists use numerous techniques of investigation to answer this question. The three main ones
are design, analysis, and experimentation.
One way to demonstrate that a particular problem can be solved is to actually design a solution. That is,
we develop a step-by-step process for achieving the desired result. Computer scientists call this an algorithm.
That’s a fancy word that basically means “recipe.” The design of algorithms is one of the most important
facets of computer science. In this book you will find techniques for designing and implementing algorithms.
One weakness of design is that it can only answer the question What is computable? in the positive. If I
can devise an algorithm, then the problem is solvable. However, failing to find an algorithm does not mean
that a problem is unsolvable. It may mean that I’m just not smart enough, or I haven’t hit upon the right idea
yet. This is where analysis comes in.
Analysis is the process of examining algorithms and problems mathematically. Computer scientists have
shown that some seemingly simple problems are not solvable by any algorithm. Other problems are in-
tractable. The algorithms that solve these problems take too long or require too much memory to be of
practical value. Analysis of algorithms is an important part of computer science; throughout this book we
will touch on some of the fundamental principles. Chapter 13 has examples of unsolvable and intractable
problems.
Some problems are too complex or ill-defined to lend themselves to analysis. In such cases, computer
scientists rely on experimentation; they actually implement systems and then study the resulting behavior.
Even when theoretical analysis is done, experimentation is often needed in order to verify and refine the
1.4. HARDWARE BASICS 3

Output Devices
CPU

Input Devices

Secondary
Main Memory
Memory

Figure 1.1: Functional View of a Computer.

analysis. For most problems, the bottom-line is whether a working, reliable system can be built. Often we
require empirical testing of the system to determine that this bottom-line has been met. As you begin writing
your own programs, you will get plenty of opportunities to observe your solutions in action.

1.4 Hardware Basics

You don’t have to know all the details of how a computer works to be a successful programmer, but under-
standing the underlying principles will help you master the steps we go through to put our programs into
action. It’s a bit like driving a car. Knowing a little about internal combustion engines helps to explain why
you have to do things like fill the gas tank, start the engine, step on the accelerator, etc. You could learn
to drive by just memorizing what to do, but a little more knowledge makes the whole process much more
understandable. Let’s take a moment to “look under the hood” of your computer.
Although different computers can vary significantly in specific details, at a higher level all modern digital
computers are remarkably similar. Figure 1.1 shows a functional view of a computer. The central processing
unit (CPU) is the “brain” of the machine. This is where all the basic operations of the computer are carried
out. The CPU can perform simple arithmetic operations like adding two numbers and can also do logical
operations like testing to see if two numbers are equal.
The memory stores programs and data. The CPU can only directly access information that is stored in
main memory (called RAM for Random Access Memory). Main memory is fast, but it is also volatile. That is,
when the power is turned off, the information in the memory is lost. Thus, there must also be some secondary
memory that provides more permanent storage. In a modern personal computer, this is usually some sort of
magnetic medium such as a hard disk (also called a hard drive) or floppy.
Humans interact with the computer through input and output devices. You are probably familiar with
common devices such as a keyboard, mouse, and monitor (video screen). Information from input devices is
processed by the CPU and may be shuffled off to the main or secondary memory. Similarly, when information
needs to be displayed, the CPU sends it to one or more output devices.
So what happens when you fire up your favorite game or word processing program? First, the instructions
that comprise the program are copied from the (more) permanent secondary memory into the main memory
of the computer. Once the instructions are loaded, the CPU starts executing the program.
Technically the CPU follows a process called the fetch execute cycle. The first instruction is retrieved
from memory, decoded to figure out what it represents, and the appropriate action carried out. Then the next
instruction is fetched, decoded and executed. The cycle continues, instruction after instruction. This is really
all the computer does from the time that you turn it on until you turn it off again: fetch, decode, execute. It
doesn’t seem very exciting, does it? But the computer can execute this stream of simple instructions with
blazing speed, zipping through millions of instructions each second. Put enough simple instructions together
in just the right way, and the computer does amazing things.
4 CHAPTER 1. COMPUTERS AND PROGRAMS

1.5 Programming Languages


Remember that a program is just a sequence of instructions telling a computer what to do. Obviously, we
need to provide those instructions in a language that a computer can understand. It would be nice if we could
just tell a computer what to do using our native language, like they do in science fiction movies. (“Computer,
how long will it take to reach planet Alphalpha at maximum warp?”) Unfortunately, despite the continuing
efforts of many top-flight computer scientists (including your author), designing a computer to understand
human language is still an unsolved problem.
Even if computers could understand us, human languages are not very well suited for describing complex
algorithms. Natural language is fraught with ambiguity and imprecision. For example, if I say: “I saw the
man in the park with the telescope,” did I have the telescope, or did the man? And who was in the park? We
understand each other most of the time only because all humans share a vast store of common knowledge and
experience. Even then, miscommunication is commonplace.
Computer scientists have gotten around this problem by designing notations for expressing computa-
tions in an exact, and unambiguous way. These special notations are called programming languages. Every
structure in a programming language has a precise form (its syntax) and a precise meaning (its semantics). A
programming language is something like a code for writing down the instructions that a computer will follow.
In fact, programmers often refer to their programs as computer code, and the process of writing an algorithm
in a programming language is called coding.
Python is one example of a programming language. It is the language that we will use throughout this
book. You may have heard of some other languages, such as C++, Java, Perl, Scheme, or BASIC. Although
these languages differ in many details, they all share the property of having well-defined, unambiguous syntax
and semantics.
All of the languages mentioned above are examples of high-level computer languages. Although they are
precise, they are designed to be used and understood by humans. Strictly speaking, computer hardware can
only understand very low-level language known as machine language.
Suppose we want the computer to add two numbers. The instructions that the CPU actually carries out
might be something like this.

load the number from memory location 2001 into the CPU
load the number from memory location 2002 into the CPU
Add the two numbers in the CPU
store the result into location 2003

This seems like a lot of work to add two numbers, doesn’t it? Actually, it’s even more complicated than this
because the instructions and numbers are represented in binary notation (as sequences of 0s and 1s).
In a high-level language like Python, the addition of two numbers can be expressed more naturally: c =
a + b. That’s a lot easier for us to understand, but we need some way to translate the high-level language
into the machine language that the computer can execute. There are two ways to do this: a high-level language
can either be compiled or interpreted.
A compiler is a complex computer program that takes another program written in a high-level language
and translates it into an equivalent program in the machine language of some computer. Figure 1.2 shows
a block diagram of the compiling process. The high-level program is called source code, and the resulting
machine code is a program that the computer can directly execute. The dashed line in the diagram represents
the execution of the machine code.
An interpreter is a program that simulates a computer that understands a high-level language. Rather than
translating the source program into a machine language equivalent, the interpreter analyzes and executes the
source code instruction by instruction as necessary. Figure 1.3 illustrates the process.
The difference between interpreting and compiling is that compiling is a one-shot translation; once a
program is compiled, it may be run over and over again without further need for the compiler or the source
code. In the interpreted case, the interpreter and the source are needed every time the program runs. Compiled
programs tend to be faster, since the translation is done once and for all, but interpreted languages lend
themselves to a more flexible programming environment as programs can be developed and run interactively.
The translation process highlights another advantage that high-level languages have over machine lan-
guage: portability. The machine language of a computer is created by the designers of the particular CPU.
1.6. THE MAGIC OF PYTHON 5

Source
Code Compiler Machine
(Program) Code

Running
Outputs
Inputs Program

Figure 1.2: Compiling a High-Level Language

Source
Code Computer
(Program)
Running an
Outputs
Interpreter
Inputs

Figure 1.3: Interpreting a High-Level Language.

Each kind of computer has its own machine language. A program for a Pentium CPU won’t run on a Mac-
intosh that sports a PowerPC. On the other hand, a program written in a high-level language can be run on
many different kinds of computers as long as there is a suitable compiler or interpreter (which is just another
program). For example, if I design a new computer, I can also program a Python interpreter for it, and then
any program written in Python can be run on my new computer, as is.

1.6 The Magic of Python


Now that you have all the technical details, it’s time to start having fun with Python. The ultimate goal is
to make the computer do our bidding. To this end, we will write programs that control the computational
processes inside the machine. You have already seen that there is no magic in this process, but in some ways
programming feels like magic.
The computational processes inside the computer are like magical spirits that we can harness for our
work. Unfortunately, those spirits only understand a very arcane language that we do not know. What we
need is a friendly Genie that can direct the spirits to fulfill our wishes. Our Genie is a Python interpreter. We
can give instructions to the Python interpreter, and it directs the underlying spirits to carry out our demands.
We communicate with the Genie through a special language of spells and incantations (i.e., Python). The
best way to start learning about Python is to let our Genie out of the bottle and try some spells.
You can start the Python interpreter in an interactive mode and type in some commands to see what
happens. When you first start the interpreter program, you may see something like the following:

Python 2.1 (#1, Jun 21 2001, 11:39:00)


[GCC pgcc-2.91.66 19990314 (egcs-1.1.2 release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>>

The  is a Python prompt indicating that the Genie is waiting for us to give it a command. In programming
languages, a complete command is called a statement.
Here is a sample interaction with the Python interpreter.
6 CHAPTER 1. COMPUTERS AND PROGRAMS

>>> print "Hello, World"


Hello, World
>>> print 2 + 3
5
>>> print "2 + 3 =", 2 + 3
2 + 3 = 5

Here I have tried out three examples using the Python print statement. The first statement asks Python to
display the literal phrase Hello, World. Python responds on the next line by printing the phrase. The second
print statement asks Python to print the sum of 2 and 3. The third print combines these two ideas.
Python prints the part in quotes “2 + 3 =” followed by the result of adding 2 + 3, which is 5.
This kind of interaction is a great way to try out new things in Python. Snippets of interactive sessions
are sprinkled throughout this book. When you see the Python prompt  in an example, that should tip
you off that an interactive session is being illustrated. It’s a good idea to fire up Python and try the examples
for yourself.
Usually we want to move beyond snippets and execute an entire sequence of statements. Python lets us
put a sequence of statements together to create a brand-new command called a function. Here is an example
of creating a new function called hello.

>>> def hello():


print "Hello"
print "Computers are Fun"

>>>

The first line tells Python that we are defining a new function called hello. The following lines are indented
to show that they are part of the hello function. The blank line (obtained by hitting the <Enter> key
twice) lets Python know that the definition is finished, and the interpreter responds with another prompt.
Notice that the definition did not cause anything to happen. We have told Python what should happen when
the hello function is used as a command; we haven’t actually asked Python to perform it yet.
A function is invoked by typing its name. Here’s what happens when we use our hello command.

>>> hello()
Hello
Computers are Fun
>>>

Do you see what this does? The two print statements from the hello function are executed in sequence.
You may be wondering about the parentheses in the definition and use of hello. Commands can have
changeable parts called parameters that are placed within the parentheses. Let’s look at an example of a
customized greeting using a parameter. First the definition:

>>> def greet(person):


print "Hello", person
print "How are you?"

Now we can use our customized greeting.

>>> greet("John")
Hello John
How are you?
>>> greet("Emily")
Hello Emily
How are you?
>>>
1.6. THE MAGIC OF PYTHON 7

Can you see what is happening here? When we use greet we can send different names to customize the
result. We will discuss parameters in detail later on. For the time being, our functions will not use parameters,
so the parentheses will be empty, but you still need to include them when defining and using functions.
One problem with entering functions interactively at the Python prompt like this is that the definitions go
away when we quit Python. If we want to use them again the next time, we have to type them all over again.
Programs are usually created by typing definitions into a separate file called a module or script. This file is
saved on a disk so that it can be used over and over again.
A module file is just a text file, and you can create one using any program for editing text, like a notepad or
word processor program (provided you save your program as a “plain text” file). A special type of program
known as a programming environment simplifies the process. A programming environment is specifically
designed to help programmers write programs and includes features such as automatic indenting, color high-
lighting, and interactive development. The standard Python distribution includes a programming environment
called Idle that you may use for working on the programs in this book.
Let’s illustrate the use of a module file by writing and running a complete program. Our program will
illustrate a mathematical concept known as chaos. Here is the program as we would type it into Idle or some
other editor and save in a module file:
# File: chaos.py
# A simple program illustrating chaotic behavior.

def main():
print "This program illustrates a chaotic function"
x = input("Enter a number between 0 and 1: ")
for i in range(10):
x = 3.9 * x * (1 - x)
print x

main()
This file should be saved with with the name chaos.py. The .py extension indicates that this is a
Python module. You can see that this particular example contains lines to define a new function called main.
(Programs are often placed in a function called main.) The last line of the file is the command to invoke
this function. Don’t worry if you don’t understand what main actually does; we will discuss it in the next
section. The point here is that once we have a program in a module file, we can run it any time we want.
This program can be run in a number of different ways that depend on the actual operating system and
programming environment that you are using. If you are using a windowing system, you can run a Python
program by (double-)clicking on the module file’s icon. In a command-line situation, you might type a
command like python chaos.py. If you are using Idle (or another programming environment) you can
run a program by opening it in the editor and then selecting a command like import, run, or execute.
One method that should always work is to start the Python interpreter and then import the file. Here is
how that looks.
>>> import chaos
This program illustrates a chaotic function
Enter a number between 0 and 1: .25
0.73125
0.76644140625
0.698135010439
0.82189581879
0.570894019197
0.955398748364
0.166186721954
0.540417912062
0.9686289303
0.118509010176
>>>
Exploring the Variety of Random
Documents with Different Content
But he also realised that his love of creatures had been turned
round and was working from the other end. The donkey was a
companion, and not a monstrosity. It was dear because it was near,
not because it was distant. The oyster had attracted him because it
was utterly unlike a man; unless it be counted a touch of masculine
vanity to grow a beard. The fancy is no idler than that he had
himself used, in suggesting a sort of feminine vanity in the
permanence of a pearl. But in that maddening vigil among the
mystic pines, he found himself more and more drawn toward the
donkey, because it was more like a man than anything else around
him; because it had eyes to see, and ears to hear—and the latter
even unduly developed.
“He that hath ears to hear, let him hear,” he said, scratching those
grey hairy flappers with affection. “Haven’t you lifted your ears
toward Heaven? And will you be the first to hear the Last Trumpet?”
The ass rubbed his nose against him with what seemed almost
like a human caress. And Dorian caught himself wondering how a
caress from an oyster could be managed. Everything else around
him was beautiful, but inhuman. Only in the first glory of anger
could he really trace in a tall pine-tree the features of an ex-taxi-
cabman from Kennington. Trees and ferns had no living ears that
they could wag nor mild eyes that they could move. He patted the
donkey again.
But the donkey had reconciled him to the landscape, and in his
third mood he began to realize how beautiful it was. On a second
study, he was not sure it was so inhuman. Rather he felt that its
beauty at least was half human; that the aureole of the sinking
moon behind the woods was chiefly lovely because it was like the
tender-coloured aureole of an early saint; and that the young trees
were, after all, noble because they held up their heads like virgins.
Cloudily there crowded into his mind ideas with which it was
imperfectly familiar, especially an idea which he had heard called
“The Image of God.” It seemed to him more and more that all these
things, from the donkey to the very docks and ferns by the roadside,
were dignified and sanctified by their partial resemblance to
something else. It was as if they were baby drawings: the wild,
crude sketches of Nature in her first sketch-books of stone.
He had flung himself on a pile of pine-needles to enjoy the
gathering darkness of the pinewoods as the moon sank behind
them. There is nothing more deep and wonderful than really
impenetrable pinewoods where the nearer trees show against the
more shadowy; a tracery of silver upon grey and of grey upon black.
It was, by this time, in pure pleasure and idleness that he picked
up a pine-needle to philosophise about it.
“Think of sitting on needles!” he said. “Yet, I suppose this is the
sort of needle that Eve, in the old legend, used in Eden. Aye, and
the old legend was right, too! Think of sitting on all the needles in
London! Think of sitting on all the needles in Sheffield! Think of
sitting on any needles, except on all the needles of Paradise! Oh,
yes, the old legend was right enough. The very needles of God are
softer than the carpets of men.”
He took a pleasure in watching the weird little forest animals
creeping out from under the green curtains of the wood. He
reminded himself that in the old legend they had been as tame as
the ass, as well as being as comic. He thought of Adam naming the
animals, and said to a beetle, “I should call you Budger.”
The slugs gave him great entertainment, and so did the worms.
He felt a new and realistic interest in them which he had not known
before; it was, indeed, the interest that a man feels in a mouse in a
dungeon; the interest of any man tied by the leg and forced to see
the fascination of small things. Creatures of the wormy kind,
especially, crept out at very long intervals; yet he found himself
waiting patiently for hours for the pleasure of their acquaintance.
One of them rather specially arrested his eye, because it was a little
longer than most worms and seemed to be turning its head in the
direction of the donkey’s left foreleg. Also, it had a head to turn,
which most worms have not.
Dorian Wimpole did not know much about exact Natural History,
except what he had once got up very thoroughly from an
encyclopedia for the purposes of a sympathetic vilanelle. But as this
information was entirely concerned with the conjectural causes of
laughter in the Hyena, it was not directly helpful in this case. But
though he did not know much Natural History, he knew some. He
knew enough to know that a worm ought not to have a head, and
especially not a squared and flattened head, shaped like a spade or
a chisel. He knew enough to know that a creeping thing with a head
of that pattern survives in the English country sides, though it is not
common. In short, he knew enough to step across the road and set
a sharp and savage boot-heel on the neck and spine of the creature,
breaking it into three black bits that writhed once more before they
stiffened.
Then he gave out a great explosive sigh. The donkey, whose leg
had been in such danger, looked at the dead adder with eyes that
had never lost their moony mildness. Even Dorian, himself, looked at
it for a long time, and with feelings he could neither arrest nor
understand, before he remembered that he had been comparing the
little wood to Eden.
“And even in Eden,” he said at last; and then the words of
Fitzgerald failed upon his lips.
And while he was warring with such words and thoughts,
something happened about him and behind him; something he had
written about a hundred times and read about a thousand;
something he had never seen in his life. It flung faintly across the
broad foliage a wan and pearly light far more mysterious than the
lost moonshine. It seemed to enter through all the doors and
windows of the woodland, pale and silent but confident, like men
that keep a tryst; soon its white robes had threads of gold and
scarlet: and the name of it was morning.
For some time past, loud and in vain, all the birds had been
singing to the Poet of the Birds. But when that minstrel actually saw
broad daylight breaking over wood and road, the effect on him was
somewhat curious. He stood staring at it in gaping astonishment,
until it had fulfilled the fulness of its shining fate; and the pine-cones
and the curling ferns and the live donkey and the dead viper were
almost as distinct as they could be at noon, or in a Preraphaelite
picture. And then the Fourth Mood fell upon him like a bolt from the
blue, and he strode across and took the donkey’s bridle, as if to lead
it along.
“Damn it all,” he cried, in a voice as cheerful as the cockcrow that
rang recently from the remote village, “it’s not everybody who’s
killed a snake.” Then he added, reflectively, “I bet Dr. Gluck never
did. Come along, donkey, let’s have some adventures.”
The finding and fighting of positive evil is the beginning of all fun
—and even of all farce. All the wild woodland looked jolly now the
snake was killed. It was one of the fallacies of his literary clique to
refer all natural emotions to literary names, but it might not untruly
be said that he had passed out of the mood of Maeterlinck into the
mood of Whitman, and out of the mood of Whitman into the mood
of Stevenson. He had not been a hypocrite when he asked for gilded
birds of Asia or purple polypi out of the Southern Seas; he was not a
hypocrite now, when he asked for mere comic adventures along a
common English road. It was his misfortune and not his fault if his
first adventure was his last; and was much too comic to laugh at.
Already the wan morning had warmed into a pale blue and was
spotted with those little plump pink clouds which must surely have
been the origin of the story that pigs might fly. The insects of the
grass chattered so cheerfully that every green tongue seemed to be
talking. The skyline on every side was broken only by objects that
encouraged such swashbucklering comedy. There was a windmill
that Chaucer’s Miller might have inhabited or Cervantes’ champion
charged. There was an old leaden church spire that might have been
climbed by Robert Clive. Away toward Pebblewick and the sea, there
were the two broken stumps of wood which Humphrey Pump
declares to this day to have been the stands for an unsuccessful
children’s swing; but which tourists always accept as the remains of
the antique gallows. In the gaiety of such surroundings, it is small
wonder if Dorian and the donkey stepped briskly along the road. The
very donkey reminded him of Sancho Panza.
He did not wake out of this boisterous reverie of the white road
and the wind till a motor horn had first hooted and then howled, till
the ground had shaken with the shock of a stoppage, and till a
human hand fell heavily and tightly on his shoulder. He looked up
and saw the complete costume of a Police Inspector. He did not
worry about the face. And there fell on him the Fifth, or Unexpected
Mood, which is called by the vulgar Astonishment.
In despair he looked at the motor car itself that had anchored so
abruptly under the opposite hedge. The man at the steering wheel
was so erect and unresponsive that Dorian felt sure he was feasting
his eyes on yet another policeman. But on the seat behind was a
very different figure, a figure that baffled him all the more because
he felt certain he had seen it somewhere. The figure was long and
slim, with sloping shoulders, and the costume, which was untidy, yet
contrived to give the impression that it was tidy on other occasions.
The individual had bright yellow hair, one lock of which stuck straight
up and was exalted, like the little horn in his favorite scriptures.
Another tuft of it, in a bright but blinding manner, fell across and
obscured the left optic, as in literal fulfilment of the parable of a
beam in the eye. The eyes, with or without beams in them, looked a
little bewildered, and the individual was always nervously resettling
his necktie. For the individual went by the name of Hibbs, and had
only recently recovered from experiences wholly new to him.
“What on earth do you want?” asked Wimpole of the policeman.
His innocent and startled face, and perhaps other things about his
appearance, evidently caused the Inspector to waver.
“Well, it’s about this ’ere donkey, sir,” he said.
“Do you think I stole it?” cried the indignant aristocrat. “Well, of all
the mad worlds! A pack of thieves steal my Limousine, I save their
damned donkey’s life at the risk of my own—and I’m run in for
stealing.”
The clothes of the indignant aristocrat probably spoke louder than
his tongue; the officer dropped his hand, and after consulting some
papers in his hand, walked across to consult with the unkempt
gentleman in the car.
“That seems to be a similar cart and donkey,” Dorian heard him
saying, “but the clothes don’t seem to fit your description of the men
you saw.”
Now, Mr. Hibbs had extremely vague and wild recollections of the
men he saw; he could not even tell what he had done and what he
had merely dreamed. If he had spoken sincerely, he would have
described a sort of green nightmare of forests, in which he found
himself in the power of an ogre about twelve feet high, with scarlet
flames for hair and dressed rather like Robin Hood. But a long
course of what is known as “keeping the party together” had made it
as unnatural to him to tell anyone (even himself) what he really
thought about anything, as it would have been to spit—or to sing.
He had at present only three motives and strong resolves: (1) not to
admit that he had been drunk; (2) not to let anyone escape whom
Lord Ivywood might possibly want to question; and (3) not to lose
his reputation for sagacity and tact.
“This party has a brown velvet suit, you see, and a fur overcoat,”
the Inspector continued, “and in the notes I have from you, you say
the man wore a uniform.”
“When we say uniform,” said Mr. Hibbs, frowning intellectually,
“when we say uniform, of course—we must distinguish some of our
friends who don’t quite see eye to eye with us, you know,” and he
smiled with tender leniency, “some of our friends wouldn’t like it
called a uniform perhaps. But—of course—well, it wasn’t a police
uniform, for instance. Ha! Ha!”
“I should hope not,” said the official, shortly.
“So—in a way—however,” said Hibbs, clutching his verbal talisman
at last, “it might be brown velvet in the dark.”
The Inspector replied to this helpful suggestion with some wonder.
“But it was a moon, like limelight,” he protested.
“Yars, yars,” cried Hibbs, in a high tone that can only be described
as a hasty drawl. “Yars—discolours everything of course. The flowers
and things—”
“But look here,” said the Inspector, “you said the principal man’s
hair was red.”
“A blond type! A blond type!” said Hibbs, waving his hand with a
solemn lightness. “Reddish, yellowish, brownish sort of hair, you
know.” Then he shook his head and said with the heaviest solemnity
the word was capable of carrying, “Teutonic, purely Teutonic.”
The Inspector began to feel some wonder that, even in the
confusion following on Lord Ivywood’s fall, he had been put under
the guidance of this particular guide. The truth was that Leveson,
once more masking his own fears under his usual parade of hurry,
had found Hibbs at a table by an open window, with wild hair and
sleepy eyes, picking himself up with some sort of medicine. Finding
him already fairly clear-headed in a dreary way, he had not scrupled
to use the remains of his bewilderment to despatch him with the
police in the first pursuit. Even the mind of a semi-recovered
drunkard, he thought, could be trusted to recognise anyone so
unmistakable as the Captain.
But, though the diplomatist’s debauch was barely over, his
strange, soft fear and cunning were awake. He felt fairly certain the
man in the fur coat had something to do with the mystery, as men
with fur coats do not commonly wander about with donkeys. He was
afraid of offending Lord Ivywood, and at the same time, afraid of
exposing himself to a policeman.
“You have large discretion,” he said, gravely. “Very right you
should have large discretion in the interests of the public. I think you
would be quite authorised, for the present, in preventing the man’s
escape.”
“And the other man?” inquired the officer, with knitted brow. “Do
you suppose he has escaped?”
“The other man,” repeated Hibbs. However, regarding the distant
windmill through half-closed lids, as if this were a new fine shade
introduced into an already delicate question.
“Well, hang it all,” said the police officer, “you must know whether
there were two men or one.”
Gradually it dawned, in a grey dawn of horror, over the brain of
Hibbs that this was what he specially couldn’t know. He had always
heard, and read in comic papers, that a drunken man “sees double”
and beholds two lamp-posts, one of which is (as the Higher Critic
would have said) purely subjective. For all he knew (being a mere
novice) inebriation might produce the impression of the two men of
his dream-like adventure, when in truth there had only been one.
“Two men, you know—one man,” he said with a sort of moody
carelessness. “Well we can go into their numbers later; they can’t
have a very large following.” Here he shook his head very firmly.
“Quite impossible. And as the late Lord Goschen used to say, ‘You
can prove anything by statistics.’”
And here came an interruption from the other side of the road.
“And how long am I to wait here for you and your Goschens, you
silly goat,” were the intemperate wood-notes issuing from the Poet
of the Birds. “I’m shot if I’ll stand this! Come along, donkey, and let’s
pray for a better adventure next time. These are very inferior
specimens of your own race.”
And seizing the bridle of the ass again, he strode past them
swiftly, and almost as if urging the animal to a gallop.
Unfortunately this disdainful dash for liberty was precisely what
was wanting to weigh down the rocking intelligence of the Inspector
on the wrong side. If Wimpole had stood still a minute or two longer,
the official, who was no fool, might have ended in disbelieving
Hibbs’s story altogether. As it was, there was a scuffle, not without
blows on both sides, and eventually the Honourable Dorian Wimpole,
donkey and all, was marched off to the village, in which there was a
Police Station; in which was a temporary cell; in which a Sixth Mood
was experienced.
His complaints, however, were at once so clamorous and so
convincing, and his coat was so unquestionably covered with fur,
that after some questioning and cross purposes they agreed to take
him in the afternoon to Ivywood House, where there was a
magistrate incapacitated by a shot only recently extracted from his
leg.
They found Lord Ivywood lying on a purple ottoman, in the midst
of his Chinese puzzle of oriental apartments. He continued to look
away as they entered, as if expecting, with Roman calm, the
entrance of a recognised enemy. But Lady Enid Wimpole, who was
attending to the wants of the invalid, gave a sharp cry of
astonishment; and the next moment the three cousins were looking
at each other. One could almost have guessed they were cousins, all
being (as Mr. Hibbs subtly put it) a blond type. But two of the blond
types expressed amazement, and one blond type merely rage.
“I am sorry, Dorian,” said Ivywood, when he had heard the whole
story. “These fanatics are capable of anything, I fear, and you very
rightly resent their stealing your car—”
“You are wrong, Phillip,” answered the poet, emphatically. “I do
not even faintly resent their stealing my car. What I do resent is the
continued existence on God’s earth of this Fool” (pointing to the
serious Hibbs) “and of that Fool” (pointing to the Inspector) “and—
yes, by thunder, of that Fool, too” (and he pointed straight at Lord
Ivywood). “And I tell you frankly, Phillip, if there really are, as you
say, two men who are bent on smashing your schemes and making
your life a hell—I am very happy to put my car at their disposal. And
now I’m off.”
“You’ll stop to dinner?” inquired Ivywood, with frigid forgiveness.
“No, thanks,” said the disappearing bard, “I’m going up to town.”
The Seventh Mood of Dorian Wimpole had a grand finale at the
Café Royal, and consisted largely of oysters.
CHAPTER XVII

THE POET IN PARLIAMENT

During the singular entrance and exit of Dorian Wimpole, M.P., J.P.,
etc., Lady Joan was looking out of the magic casements of that
turret room which was now literally, and not only poetically, the last
limit of Ivywood House. The old broken hole and black staircase up
which the lost dog Quoodle used to come and go, had long ago
been sealed up and cemented with a wall of exquisite Eastern
workmanship. All through the patterns Lord Ivywood had preserved
and repeated the principle that no animal shape must appear. But,
like all lucid dogmatists, he perceived all the liberties his dogma
allowed him. And he had irradiated this remote end of Ivywood with
sun and moon and solar and starry systems, with the Milky Way for
a dado and a few comets for comic relief. The thing was well done of
its kind (as were all the things that Phillip Ivywood got done for
him); and if all the windows of the turret were closed with their
peacock curtains, a poet with anything like a Hibbsian appreciation
of the family champagne might almost fancy he was looking out
across the sea on a night crowded with stars. And (what was yet
more important) even Misysra (that exact thinker) could not call the
moon a live animal without falling into idolatry.
But Joan, looking out of real windows on a real sky and sea,
thought no more about the astronomical wall-paper than about any
other wall-paper. She was asking herself in sullen emotionalism, and
for the thousandth time, a question she had never been able to
decide. It was the final choice between an ambition and a memory.
And there was this heavy weight in the scale: that the ambition
would probably materialise, and the memory probably wouldn’t. It
has been the same weight in the same scale a million times, since
Satan became the prince of this world. But the evening stars were
strengthening over the old sea-shore, and they also wanted
weighing like diamonds.
As once before at the same stage of brooding, she heard behind
her the swish of Lady Enid’s skirts, that never came so fast save for
serious cause.
“Joan! Please do come! Nobody but you, I do believe, could move
him.” Joan looked at Lady Enid and realised that the lady was close
on crying. She turned a trifle pale and asked quietly for the question.
“Phillip says he’s going to London now, with that leg and all,” cried
Enid, “and he won’t let us say a word.”
“But how did it all happen?” asked Joan.
Lady Enid Wimpole was quite incapable of explaining how it all
happened, so the task must for the moment devolve on the author.
The simple fact was that Ivywood in the course of turning over
magazines on his sofa, happened to look at a paper from the
Midlands.
“The Turkish news,” said Mr. Leveson, rather nervously, “is on the
other side of the page.”
But Lord Ivywood continued to look at the side of the paper that
did not contain the Turkish news, with the same dignity of lowered
eyelids and unconscious brow with which he had looked at the
Captain’s message when Joan found him by the turret.
On the page covered merely with casual, provincial happenings
was a paragraph, “Echo of Pebblewick Mystery. Reported
Reappearance of the Vanishing Inn.” Underneath was printed, in
smaller letters:
“An almost incredible report from Wyddington announces that the
mysterious ‘Sign of the Old Ship’ has once more been seen in this
country; though it has long been relegated by scientific investigators to
the limbo of old rustic superstitions. According to the local version, Mr.
Simmons, a dairyman of Wyddington, was serving in his shop when two
motorists entered, one of them asking for a glass of milk. They were in
the most impenetrable motoring panoply, with darkened goggles and
waterproof collars turned up, so that nothing can be recalled of them
personally, except that one was a person of unusual stature. In a few
moments, this latter individual went out of the shop again and returned
with a miserable specimen out of the street, one of the tattered loafers
that linger about our most prosperous towns, tramping the streets all
night and even begging in defiance of the police. The filth and disease of
the creature were so squalid that Mr. Simmons at first refused to serve
him with the glass of milk which the taller motorist wished to provide for
him. At length, however, Mr. Simmons consented, and was immediately
astonished by an incident against which he certainly had a more assured
right to protest.
“The taller motorist, saying to the loafer, ‘but, man, you’re blue in the
face,’ made a species of signs to the smaller motorist, who thereupon
appears to have pierced a sort of cylindrical trunk or chest that seemed
to be his only luggage, and drawn from it a few drops of a yellow liquid
which he deliberately dropped into the ragged creature’s milk. It was
afterward discovered to be rum, and the protests of Mr. Simmons may be
imagined. The tall motorist, however, warmly defended his action, having
apparently some wild idea that he was doing an act of kindness. ‘Why, I
found the man nearly fainting,’ he said. ‘If you’d picked him off a raft, he
couldn’t be more collapsed with cold and sickness; and if you’d picked
him off a raft you’d have given him rum—yes, by St. Patrick, if you were
a bloody pirate and made him walk the plank afterward.’ Mr. Simmons
replied with dignity, that he did not know how it was with rafts, and could
not permit such language in his shop. He added that he would lay himself
open to a police prosecution if he permitted the consumption of alcohol
in his shop; since he did not display a sign. The motorist then made the
amazing reply, ‘But you do display a sign, you jolly old man. Did you
think I couldn’t find my way to the sign of The Old Ship, you sly boots?’
Mr. Simmons was now fully convinced of the intoxication of his visitors,
and refusing a glass of rum rather boisterously offered him, went outside
his shop to look round for a policeman. To his surprise he found the
officer engaged in dispersing a considerable crowd, which was staring up
at some object behind him. On looking round (he states in his deposition)
he ‘saw what was undoubtedly one of the low tavern signs at one time
common in England.’ He was wholly unable to explain its presence
outside his premises, and as it undoubtedly legalised the motorist’s
action, the police declined to move in the matter.
“Later. The two motorists have apparently left the town, unmolested, in
a small second-hand two-seater. There is no clue to their destination,
except it be indicated by a single incident. It appears that when they
were waiting for the second glass of milk, one of them drew attention to
a milk-can of a shape seemingly unfamiliar to him, which was, of course,
the Mountain Milk now so much recommended by doctors. The taller
motorist (who seemed in every way strangely ignorant of modern science
and social life) asked his companion where it came from, receiving, of
course, the reply that it is manufactured in the model village of
Peaceways, under the personal superintendence of its distinguished and
philanthropic inventor, Dr. Meadows. Upon this the taller person, who
appeared highly irresponsible, actually bought the whole can; observing,
as he tucked it under his arm, that it would help him to remember the
address.
“Later. Our readers will be glad to hear that the legend of ‘The Old
Ship’ sign has once more yielded to the wholesome scepticism of science.
Our representative reached Wyddington after the practical jokers, or
whatever they were, had left; but he searched the whole frontage of Mr.
Simmons’s shop, and we are in a position to assure the public that there
is no trace of the alleged sign.”

Lord Ivywood laid down the newspaper and looked at the rich and
serpentine embroideries on the wall with the expression that a great
general might have if he saw a chance of really ruining his enemy, if
he would also ruin all his previous plan of campaign. His pallid and
classic profile was as immovable as a cameo; but anyone who had
known him at all would have known that his brain was going like a
motor car that has broken the speed limit long ago.
Then he turned his head and said, “Please tell Hicks to bring
round the long blue car in half an hour; it can be fitted up for a sofa.
And ask the gardener to cut a pole of about four feet nine inches,
and put a cross-piece for a crutch. I’m going up to London tonight.”
Mr. Leveson’s lower jaw literally fell with astonishment.
“The Doctor said three weeks,” he said. “If I may ask it, where are
you going?”
“St. Stephens, Westminster,” answered Ivywood.
“Surely,” said Mr. Leveson, “I could take a message.”
“You could take a message,” assented Ivywood, “I’m afraid they
would not allow you to make a speech.”
It was a moment or two afterward that Enid Wimpole had come
into the room, and striven in vain to shake his decision. Then it was
that Joan had been brought out of the turret and saw Phillip
standing, sustained upon a crutch of garden timber; and admired
him as she had never admired him before. While he was being
helped downstairs, while he was being propped in the car with such
limited comfort as was possible, she did really feel in him something
worthy of his ancient roots, worthy of such hills and of such a sea.
For she felt God’s wind from nowhere which is called the Will; and is
man’s only excuse upon this earth. In the small toot of the starting
motor she could hear a hundred trumpets, such as might have called
her ancestors and his to the glories of the Third Crusade.
Such imaginary military honours were not, at least in the strategic
sense, undeserved. Lord Ivywood really had seen the whole map of
the situation in front of him, and swiftly formed a plan to meet it, in
a manner not unworthy of Napoleon. The realities of the situation
unrolled themselves before him, and his mind was marking them
one by one as with a pencil.
First, he knew that Dalroy would probably go to the Model Village.
It was just the sort of place he would go to. He knew Dalroy was
almost constitutionally incapable of not kicking up some kind of row
in a place of that kind.
Second, he knew that if he missed Dalroy at this address, it was
very likely to be his last address; he and Mr. Pump were quite clever
enough to leave no more hints behind.
Third, he guessed, by careful consideration of map and clock, that
they could not get to so remote a region in so cheap a car under
something like two days, nor do anything very conclusive in less
than three. Thus, he had just time to turn round in.
Fourth, he realised that ever since that day when Dalroy swung
round the sign-board and smote the policeman into the ditch, Dalroy
had swung round the Ivywood Act on Lord Ivywood. He (Lord
Ivywood) had thought, and might well have thought rightly, that by
restricting the old sign-posts to a few places so select that they can
afford to be eccentric, and forbidding such artistic symbols to all
other places, he could sweep fermented liquor for all practical
purposes out of the land. The arrangement was exactly that at
which all such legislation is consciously or unconsciously aiming. A
sign-board could be a favour granted by the governing class to itself.
If a gentleman wished to claim the liberties of a Bohemian, the path
would be open. If a Bohemian wished to claim the liberties of a
gentleman, the path would be shut. So, gradually, Lord Ivywood had
thought, the old signs which can alone sell alcohol, will dwindle
down to mere curiosities, like Audit Ale or the Mead that may still be
found in the New Forest. The calculation was by no means
unstatesmanlike. But, like many other statesmanlike calculations, it
did not take into account the idea of dead wood walking about. So
long as his flying foes might set up their sign anywhere, it mattered
little whether the result was enjoyment or disappointment for the
populace. In either case it must mean constant scandal or riot. If
there was one thing worse than the appearance of “The Old Ship” it
was its disappearance.
He realised that his own law was letting them loose every time;
for the local authorities hesitated to act on the spot, in defiance of a
symbol now so exclusive and therefore impressive. He realised that
the law must be altered. Must be altered at once. Must be altered, if
possible, before the fugitives broke away from the Model Village of
Peaceways.
He realised that it was Thursday. This was the day on which any
private member of Parliament could introduce any private bill of the
kind called “non-contentious,” and pass it without a division, so long
as no particular member made any particular fuss. He realised that it
was improbable that any particular member would make any
particular fuss about Lord Ivywood’s own improvement on Lord
Ivywood’s own Act.
Finally, he realised that the whole case could be met by so slight
an improvement as this. Change the words of the Act (which he
knew by heart, as happier men might know a song): “If such sign be
present liquids containing alcohol can be sold on the premises,” to
these other words: “Liquids containing alcohol can be sold, if
previously preserved for three days on the premises”; it was mate in
a few moves. Parliament could never reject or even examine so
slight an emendation. And the revolution of “The Old Ship” and the
late King of Ithaca would be crushed for ever.
It does undoubtedly show, as we have said, something Napoleonic
in the man’s mind that the whole of this excellent and even
successful plan was complete long before he saw the great glowing
clock on the towers of Westminster; and knew he was in time.
It was unfortunate, perhaps, that about the same time, or not
long after, another gentleman of the same rank, and indirectly of the
same family, having left the restaurant in Regent Street and the
tangle of Piccadilly, had drifted serenely down Whitehall, and had
seen the same great golden goblin’s eye on the tall tower of St.
Stephen.
The Poet of the Birds, like most æsthetes, had known as little of
the real town as he had of the real country. But he had remembered
a good place for supper; and as he passed certain great cold clubs,
built of stone and looking like Assyrian Sarcophagi, he remembered
that he belonged to many of them. And so when he saw afar off,
sitting above the river, what has been very erroneously described as
the best club in London, he suddenly remembered that he belonged
to that too. He could not at the moment recall what constituency in
South England it was that he sat for; but he knew he could walk into
the place if he wanted to. He might not so have expressed the
matter, but he knew that in an oligarchy things go by respect for
persons and not for claims; by visiting cards and not by voting cards.
He had not been near the place for years, being permanently paired
against a famous Patriot who had accepted an important
government appointment in a private madhouse. Even in his silliest
days, he had never pretended to feel any respect for modern
politics, and made all haste to put his “leaders” and the mad
patriot’s “leaders” on the well selected list of the creatures whom
man forgets. He had made one really eloquent speech in the House
(on the subject of gorillas), and then found he was speaking against
his party. It was an indescribable sort of place, anyhow. Even Lord
Ivywood did not go to it except to do some business that could be
done nowhere else; as was the case that night.
Ivywood was what is called a peer by courtesy; his place was in
the Commons, and for the time being on the Opposition side. But,
though he visited the House but seldom, he knew far too much
about it to go into the Chamber itself. He limped into the Smoking
Room (though he did not smoke), procured a needless cigarette and
a much-needed sheet of note-paper, and composed a curt but
careful note to the one member of the government whom he knew
must be in the House. Having sent it up to him, he waited.
Outside, Mr. Dorian Wimpole also waited, leaning on the parapet
of Westminster Bridge and looking down the river. He was becoming
one with the oysters in a more solemn and solid sense than he had
hitherto conceived possible, and also with a strictly Vegetarian
beverage which bears the noble and starry name of Nuits. He felt at
peace with all things, even in a manner with politics. It was one of
those magic hours of evening when the red and golden lights of men
are already lit along the river, and look like the lights of goblins, but
daylight still lingers in a cold and delicate green. He felt about the
river something of that smiling and glorious sadness which two
Englishmen have expressed under the figure of the white wood of an
old ship fading like a phantom; Turner, in painting, and Henry
Newbolt, in poetry. He had come back to earth like a man fallen
from the moon; he was at bottom not only a poet but a patriot, and
a patriot is always a little sad. Yet his melancholy was mixed up with
that immutable yet meaningless faith which few Englishmen, even in
modern times, fail to feel at the unexpected sight either of
Westminster or of that height on which stands the temple of St.
Paul.
“While flows the sacred river,
While stands the sacred hill,”

he murmured in some schoolboy echo of the ballad of Lake Regillus,


“While flows the sacred river,
While stands the sacred hill,
The proud old pantaloons and nincompoops,
Who yawn at the very length of their own lies
in that accursed sanhedrim where
people put each other’s hats on in a poisonous
room with no more windows than hell
Shall have such honour still.”

Relieved by this rendering of Macaulay in the style known among


his cultured friends as vers libre, or poesy set free from the shackles
of formal metre, he strolled toward the members’ entrance and went
in.
Lacking Lord Ivywood’s experience, he strolled into the Common’s
Chamber itself and sat down on a green bench, under the
impression that the House was not sitting. He was, however,
gradually able to distinguish some six or eight drowsy human forms
from the seats on which they sat; and to hear a senile voice with an
Essex accent, saying, all on one note, and without beginning or end,
in a manner which it is quite impossible to punctuate,
“... no wish at all that this proposal should be regarded except in the
right way and have tried to put it in the right way and cannot think the
honourable member was altogether adding to his reputation in putting it
in what those who think with me must of course consider the wrong way
and I for one am free to say that if in his desire to settle this great
question he takes this hasty course and this revolutionary course about
slate pencils he may not be able to prevent the extremists behind him
from applying it to lead pencils and while I should be the last to increase
the heat and the excitement and the personalities of this debate if I could
possibly help it I must confess that in my opinion the honourable
gentleman has himself encouraged that heat and personality in a manner
that he now doubtless regrets I have no desire to use abusive terms
indeed you Mr. Speaker would not allow me of course to use abusive
terms but I must tell the honourable member face to face that the
perambulators with which he has twitted me cannot be germane to this
discussion I should be the last person....”

Dorian Wimpole had softly risen to go, when he was arrested by


the sight of someone sliding into the House and handing a note to
the solitary young man with heavy eyelids who was at that moment
governing all England from the Treasury Bench. Seeing him go out,
Dorian had a sickening sweetness of hope (as he might have said in
his earlier poems), that something intelligible might happen after all,
and followed him out almost with alacrity.
The solitary and sleepy governor of Great Britain went down into
the lower crypts of its temple of freedom and turned into an
apartment where Wimpole was astonished to see his cousin Ivywood
sitting at a little table with a large crutch leaning beside him, as
serene as Long John Silver. The young man with the heavy eyelids
sat down opposite him and they had a conversation which Wimpole,
of course, did not hear. He withdrew into an adjoining room where
he managed to procure coffee and a liqueur; an excellent liqueur
which he had forgotten and of which he had more than one glass.
But he had so posted himself that Ivywood could not come out
without passing him, and he waited for what might happen with
exquisite patience. The only thing that seemed to him queer was
that every now and then a bell rang in several rooms at once. And
whenever the bell rang, Lord Ivywood nodded, as if he were part of
the electrical machinery. And whenever Lord Ivywood nodded the
young man turned and sped upstairs like a mountaineer, returning in
a short time to resume the conversation. On the third occasion the
poet began to observe that many others from the other rooms could
be heard running upstairs at the sound of this bell, and returning
with the slightly less rapid step which expresses relief after a duty
done. Yet did he not know that this duty was Representative
Government; and that it is thus that the cry of Cumberland or
Cornwall can come to the ears of an English King.
Suddenly the sleepy young man sprang erect, uninspired by any
bell, and strode out once more. The poet could not help hearing him
say as he left the table, jotting down something with a pencil:
“Alcohol can be sold if previously preserved for three days on the
premises. I think we can do it, but you can’t come on for half an
hour.”
Saying this, he darted upstairs again, and when Dorian saw
Ivywood come out laboriously, afterward, on his large country
crutch, he had exactly the same revulsion in his favour that Joan had
had. Jumping up from his table, which was in one of the private
dining-rooms, he touched the other on the elbow and said:
“I want to apologise to you, Phillip, for my rudeness this
afternoon. Honestly, I am sorry. Pinewoods and prison-cells try a
man’s temper, but I had no rag of excuse for not seeing that for
neither of them were you to blame. I’d no notion you were coming
up to town tonight; with your leg and all. You mustn’t knock yourself
up like this. Do sit down a minute.”
It seemed to him that the bleak face of Phillip softened a little;
how far he really softened will never be known until such men as he
are understood by their fellows. It is certain that he carefully
unhooked himself from his crutch and sat down opposite his cousin.
Whereupon his cousin struck the table so that it rang like a dinner-
bell and called out, “Waiter!” as if he were in a crowded restaurant.
Then, before Lord Ivywood could protest, he said:
“It’s awfully jolly that we’ve met. I suppose you’ve come up to
make a speech. I should like to hear it. We haven’t always agreed;
but, by God, if there’s anything good left in literature it’s your
speeches reported in a newspaper. That thing of yours that ended,
‘death and the last shutting of the iron doors of defeat’—Why you
must go back to Strafford’s last speech for such English. Do let me
hear your speech! I’ve got a seat upstairs, you know.”
“If you wish it,” said Ivywood hurriedly, “but I shan’t make much
of a speech tonight.” And he looked at the wall behind Wimpole’s
head with thunderous wrinkles thickening on his brow. It was
essential to his brilliant and rapid scheme, of course, that the
Commons should make no comment at all on his little alteration in
the law.
An attendant hovered near in response to the demand for a
waiter, and was much impressed by the presence and condition of
Lord Ivywood. But as that exalted cripple resolutely refused anything
in the way of liquor, his cousin was so kind as to have a little more
himself, and resumed his remarks.
“It’s about this public-house affair of yours, I suppose. I’d like to
hear you speak on that. P’raps I’ll speak myself. I’ve been thinking
about it a good deal all day, and a good deal of last night, too. Now,
here’s what I should say to the House, if I were you. To begin with,
can you abolish the public-house? Are you important enough now to
abolish the public-house? Whether it’s right or wrong, can you in the
long run prevent haymakers having ale any more than you can
prevent me having this glass of Chartreuse?”
The attendant, hearing the word, once more drew near; but heard
no further order; or, rather, the orders he heard were such as he was
less able to cope with.
“Remember the curate!” said Dorian, abstractedly shaking his
head at the functionary, “remember the sensible little High-Church
curate, who when asked for a Temperance Sermon preached on the
text ‘Suffer us not to be overwhelmed in the water-floods.’ Indeed,
indeed, Phillip, you are in deeper waters than you know. You will
abolish ale! You will make Kent forget hop-poles, and Devonshire
forget cider! The fate of the Inn is to be settled in that hot little
room upstairs! Take care its fate and yours are not settled in the Inn.
Take care Englishmen don’t sit in judgment on you as they do on
many another corpse at an inquest—at a common public-house!
Take care that the one tavern that is really neglected and shut up
and passed like a house of pestilence is not the tavern in which I
drink tonight, and that merely because it is the worst tavern on the
King’s highway. Take care this place where we sit does not get a
name like any pub where sailors are hocussed or girls debauched.
That is what I shall say to them,” said he, rising cheerfully, “that’s
what I shall say. See you to it,” he cried with sudden passion and
apparently to the waiter, “see you to it if the sign that is destroyed is
not the sign of ‘The Old Ship’ but the sign of the Mace and Bauble,
and, in the words of a highly historical brewer, if we see a dog bark
at your going.”
Lord Ivywood was observing him with a deathly quietude; another
idea had come into his fertile mind. He knew his cousin, though
excited, was not in the least intoxicated; he knew he was quite
capable of making a speech and even a good one. He knew that any
speech, good or bad, would wreck his whole plan and send the wild
inn flying again. But the orator had resumed his seat and drained his
glass, passing a hand across his brow. And he remembered that a
man who keeps a vigil in a wood all night and drinks wine on the
following evening is liable to an accident that is not drunkenness,
but something much healthier.
“I suppose your speech will come on pretty soon,” said Dorian,
looking at the table. “You’ll let me know when it does, of course.
Really and truly, I don’t want to miss it. And I’ve forgotten all the
ways here, and feel pretty tired. You’ll let me know?”
“Yes,” said Lord Ivywood.
Stillness fell along all the rooms until Lord Ivywood broke it by
saying:
“Debate is a most necessary thing; but there are times when it
rather impedes than assists parliamentary government.”
He received no reply. Dorian still sat as if looking at the table, but
his eyelids had lightly fallen; he was asleep. Almost at the same
moment the Member of Government, who was nearly asleep,
appeared at the entrance of the long room and made some sort of
weary signal.
Phillip Ivywood raised himself on his crutch and stood for a
moment looking at the sleeping man. Then he and his crutch trailed
out of the long room, leaving the sleeping man behind. Nor was that
the only thing that he left behind. He also left behind an unlighted
cigarette and his honour and all the England of his father’s;
everything that could really distinguish that high house beside the
river from any tavern for the hocussing of sailors. He went upstairs
and did his business in twenty minutes in the only speech he had
ever delivered without any trace of eloquence. And from that hour
forth he was the naked fanatic; and could feed on nothing but the
future.
CHAPTER XVIII

THE REPUBLIC OF PEACEWAYS

In a hamlet round about Windermere, let us say, or somewhere in


Wordsworth’s country, there could be found a cottage, in which
could be found a cottager. So far all is as it should be; and the visitor
would first be conscious of a hearty and even noisy elderly man,
with an apple face and a short white beard. This person would then
loudly proffer to the visitor the opportunity of seeing his father, a
somewhat more elderly man, with a somewhat longer white beard,
but still “up and about.” And these two together would then initiate
the neophyte into the joys of the society of a grandfather, who was
more than a hundred years old, and still very proud of the fact.
This miracle, it seemed, had been worked entirely on milk. The
subject of this diet the oldest of the three men continued to discuss
in enormous detail. For the rest, it might be said that his pleasures
were purely arithmetical. Some men count their years with dismay,
and he counted his with a juvenile vanity. Some men collect stamps
or coins, and he collected days. Newspaper men interviewed him
about the historic times through which he had lived, without eliciting
anything whatever; except that he had apparently taken to an
exclusive milk diet at about the age when most of us leave it off.
Asked if he was alive in 1815, he said that was the very year he
found it wasn’t any milk, but must be Mountain Milk, like Dr.
Meadows says. Nor would his calculating creed of life have allowed
him to understand you if you had said that in a meadowland oversea
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like