[FREE PDF sample] Python for Informatics Exploring Information 1st Edition Dr. Charles R Severance ebooks
[FREE PDF sample] Python for Informatics Exploring Information 1st Edition Dr. Charles R Severance ebooks
com
https://ebookname.com/product/python-for-informatics-
exploring-information-1st-edition-dr-charles-r-severance/
OR CLICK BUTTON
DOWLOAD EBOOK
https://ebookname.com/product/modernist-informatics-literature-
information-and-the-state-1st-edition-purdon/
ebookname.com
https://ebookname.com/product/exploring-with-lewis-and-clark-charles-
floyd/
ebookname.com
https://ebookname.com/product/programming-like-a-pro-for-teens-1st-
edition-charles-r-hardnett/
ebookname.com
https://ebookname.com/product/promoting-sustainable-local-and-
community-economic-development-1st-edition-roland-v-anglin/
ebookname.com
Current Topics in Developmental Biology Vol 71 1st Edition
Gerald P. Schatten (Ed.)
https://ebookname.com/product/current-topics-in-developmental-biology-
vol-71-1st-edition-gerald-p-schatten-ed/
ebookname.com
https://ebookname.com/product/insect-symbiosis-contemporary-topics-in-
entomology-1st-edition-kostas-bourtzis/
ebookname.com
https://ebookname.com/product/construction-law-for-design-
professionals-construction-managers-and-contractors-1st-edition-
justin-sweet/
ebookname.com
https://ebookname.com/product/divorcing-the-dow-using-revolutionary-
market-indicators-to-profit-from-the-stealth-boom-ahead-1st-edition-
jim-troup/
ebookname.com
https://ebookname.com/product/hedge-fund-course-wiley-finance-1st-
edition-stuart-a-mccrary/
ebookname.com
Building Research Tools With Google For Dummies 1st
Edition Harold Davis
https://ebookname.com/product/building-research-tools-with-google-for-
dummies-1st-edition-harold-davis/
ebookname.com
Python for Informatics
Exploring Information
Version 0.0.4
Charles Severance
Copyright © 2009, 2010 Charles Severance.
Printing history:
December 2009: Begin to produce Python for Informatics: Exploring Information by re-mixing
Think Python: How to Think Like a Computer Scientist
June 2008: Major revision, changed title to Think Python: How to Think Like a Computer Scientist.
August 2007: Major revision, changed title to How to Think Like a (Python) Programmer.
April 2002: First edition of How to Think Like a Computer Scientist.
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. This
license is available at creativecommons.org/licenses/by-sa/3.0/.
The original form of this book is LATEX source code. Compiling this LATEX source has the effect
of generating a device-independent representation of a textbook, which can be converted to other
formats and printed.
The LATEX source for the Think Python: How to Think Like a Computer Scientist version of this book
is available from http://www.thinkpython.com.
The LATEX source for the Python for Informatics: Exploring Information version of the book is avail-
able from http://source.sakaiproject.org/contrib/csev/trunk/pyinf/.
The cover image shows social connectivity of NSF grant investigators at the University of Michigan
from September 1999 through October 2010 and was provided by Eric Hofer and visualized using
the GUESS software developed by Eytan Adar, both of the University of Michigan. The cover design
is by Terri Geitgey of the University of Michigan Library.
Preface
In chapters 11-14, nearly all of the material is brand new, focusing on real-world uses and
simple examples of Python for data analysis including automating tasks on your computer,
retrieving data across the network, scraping web pages for data, using web services, parsing
XML data, and creating and using databases using Structured Query Language.
The ultimate goal of all of these changes is a shift from a Computer Science to an Infor-
matics focus is to only include topics into a first technology class that can be applied even
if one chooses not to become a professional programmer.
Students who find this book interesting and want to further explore should look at Allen
B. Downey’s Think Python book. Because there is a lot of overlap between the two books,
students will quickly pick up skills in the additional areas of computing in general and
computational thinking that are covered in Think Python. And given that the books have a
similar writing style and at times have identical text and examples, you should be able to
move quickly through Think Python with a minimum of effort.
As the copyright holder of Think Python, Allen has given me permission to change the
book’s license from the GNU Free Documentation License to the more recent Creative
Commons Attribution — Share Alike license. This follows a general shift in open doc-
umentation licenses moving from the GFDL to the CC-BY-SA (i.e. Wikipedia). Using
the CC-BY-SA license maintains the book’s strong copyleft tradition while making it even
more straightforward for new authors to reuse this material as they see fit.
I feel that this book serves an example of why open materials are so important to the future
of education, and want to thank Allen B. Downey and Cambridge University Press for their
forward looking decision to make the book available under an open Copyright. I hope they
are pleased with the results of my efforts and I hope that you the reader are pleased with
our collective efforts.
Charles Severance
www.dr-chuck.com
Ann Arbor, MI, USA
July 25, 2011
In January 1999 I was preparing to teach an introductory programming class in Java. I had
taught it three times and I was getting frustrated. The failure rate in the class was too high
and, even for students who succeeded, the overall level of achievement was too low.
vii
One of the problems I saw was the books. They were too big, with too much unnecessary
detail about Java, and not enough high-level guidance about how to program. And they all
suffered from the trap door effect: they would start out easy, proceed gradually, and then
somewhere around Chapter 5 the bottom would fall out. The students would get too much
new material, too fast, and I would spend the rest of the semester picking up the pieces.
Two weeks before the first day of classes, I decided to write my own book. My goals were:
• Keep it short. It is better for students to read 10 pages than not read 50 pages.
• Be careful with vocabulary. I tried to minimize the jargon and define each term at
first use.
• Build gradually. To avoid trap doors, I took the most difficult topics and split them
into a series of small steps.
Preface v
2.6 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.7 Order of operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.8 Modulus operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.9 String operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.10 Asking the user for input . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.11 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.12 Choosing mnemonic variable names . . . . . . . . . . . . . . . . . . . . 23
2.13 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.14 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.15 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3 Conditional execution 29
3.1 Boolean expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 Logical operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.3 Conditional execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.4 Alternative execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.5 Chained conditionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.6 Nested conditionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.7 Catching exceptions using try and except . . . . . . . . . . . . . . . . . . 34
3.8 Short circuit evaluation of logical expressions . . . . . . . . . . . . . . . 35
3.9 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.10 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4 Functions 41
4.1 Function calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2 Built-in functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3 Type conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.4 Random numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Contents xi
5 Iteration 55
5.1 Updating variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.2 The while statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.3 Infinite loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.4 “Infinite loops” and break . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.5 Finishing iterations with continue . . . . . . . . . . . . . . . . . . . . . 59
5.6 Definite loops using for . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.7 Loop patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.8 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.9 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
6 Strings 65
6.1 A string is a sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.2 Getting the length of a string using len . . . . . . . . . . . . . . . . . . . 66
6.3 Traversal through a string with a for loop . . . . . . . . . . . . . . . . . 66
6.4 String slices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.5 Strings are immutable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
xii Contents
6.6 Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.7 Looping and counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.8 The in operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.9 String comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.10 string methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.11 Parsing strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.12 Format operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.13 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.14 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.15 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
7 Files 81
7.1 Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.2 Opening files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
7.3 Text files and lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.4 Reading files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.5 Searching through a file . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.6 Letting the user choose the file name . . . . . . . . . . . . . . . . . . . . 87
7.7 Using try, catch, and open . . . . . . . . . . . . . . . . . . . . . . . 88
7.8 Writing files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
7.9 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
7.10 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
8 Lists 93
8.1 A list is a sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
8.2 Lists are mutable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
8.3 Traversing a list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
8.4 List operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Contents xiii
9 Dictionaries 109
9.1 Dictionary as a set of counters . . . . . . . . . . . . . . . . . . . . . . . 111
9.2 Dictionaries and files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
9.3 Looping and dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . 113
9.4 Advanced text parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
9.5 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
9.6 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
9.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
10 Tuples 119
10.1 Tuples are immutable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
10.2 Comparing tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
10.3 Tuple assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
10.4 Dictionaries and tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
10.5 Multiple assignment with dictionaries . . . . . . . . . . . . . . . . . . . 123
10.6 The most common words . . . . . . . . . . . . . . . . . . . . . . . . . . 124
10.7 Using tuples as keys in dictionaries . . . . . . . . . . . . . . . . . . . . . 126
xiv Contents
A Debugging 187
A.1 Syntax errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
A.2 Runtime errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
A.3 Semantic errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Writing programs (or programming) is a very creative and rewarding activity. You can
write programs for many reasons ranging from making your living to solving a difficult
data analysis problem to having fun to helping someone else solve a problem. This book
assumes that everyone needs to know how to program and that once you know how to
program, you will figure out what you want to do with your newfound skills.
We are surrounded in our daily lives with computers ranging from laptops to cell phones.
We can think of these computers as our “personal assistants” who can take care of many
things on our behalf. The hardware in our current-day computers is essentially built to
continuously ask us the question, “What would you like me to do next?”.
Programmers add an operating system and a set of applications to the hardware and we
end up with a Personal Digital Assistant that is quite helpful and capable of helping many
different things.
Our computers are fast and have vast amounts of memory and could be very helpful to us
if we only knew the language to speak to explain to the computer what we would like it to
“do next”. If we knew this language we could tell the computer to do tasks on our behalf
that were repetitive. Interestingly, the kinds of things computers can do best are often the
kinds of things that we humans find boring and mind-numbing.
2 Chapter 1. Why should you learn to write programs?
For example, look at the first three paragraphs of this chapter and tell me the most com-
monly used word and how many times the word is used. While you were able to read and
understand the words in a few seconds, counting them is almost painful because it is not
the kind of problem that human minds are designed to solve. For a computer the opposite
is true, reading and understanding text from a piece of paper is hard for a computer to do
but counting the words and telling you how many times the most used word was used is
very easy for the computer:
python words.py
Enter file:words.txt
to 16
Our “personal information analysis assistant” quickly told us that the word “to” was used
sixteen times in the first three paragraphs of this chapter.
This very fact that computers are good at things that humans are not is why you need to
become skilled at talking “computer language”. Once you learn this new language, you can
delegate mundane tasks to your partner (the computer), leaving more time for you to do the
things that you are uniquely suited for. You bring creativity, intuition, and inventiveness to
this partnership.
For now, our primary motivation is not to make money or please end-users, but instead
for us to be more productive in handling the data and information that we will encounter
in our lives. When you first start, you will be both the programmer and end-user of your
1.2. Computer hardware architecture 3
programs. As you gain skill as a programmer and programming feels more creative to you,
your thoughts may turn toward developing programs for others.
What
Software Next?
Central
Input Processing
Output Network
Unit
Devices
Main
Secondary
Memory
Memory
• The Central Processing Unit (or CPU) is that part of the computer that is built to be
obsessed with “what is next?”. If your computer is rated at 3.0 Gigahertz, it means
that the CPU will ask “What next?” three billion times per second. You are going to
have to learn how to talk fast to keep up with the CPU.
• The Main Memory is used to store information that the CPU needs in a hurry. The
main memory is nearly as fast as the CPU. But the information stored in the main
memory vanishes when the computer is turned off.
• The Secondary Memory is also used to store information, but it is much slower
than the main memory. The advantage of the secondary memory is that it can store
information even when there is no power to the computer. Examples of secondary
memory are disk drives or flash memory (typically found in USB sticks and portable
music players).
• The Input and Output Devices are simply our screen, keyboard, mouse, micro-
phone, speaker, touchpad, etc. They are all of the ways we interact with the com-
puter.
4 Chapter 1. Why should you learn to write programs?
• These days, most computers also have a Network Connection to retrieve informa-
tion over a network. We can think of the network as a very slow place to store and
retrieve data that might not always be “up”. So in a sense, the network is a slower
and at times unreliable form of Secondary Memory
While most of the detail of how these components work is best left to computer builders, it
helps to have a some terminology so we can talk about these different parts as we write our
programs.
As a programmer, your job is to use and orchestrate each of these resources to solve the
problem that you need solving and analyze the data you need. As a programmer you will
mostly be “talking” to the CPU and telling it what to do next. Sometimes you will tell the
CPU to use the main memory, secondary memory, network, or the input/output devices.
What
Software Next?
Central
Input Processing
Output Network
Unit
Devices
Main
Secondary
Memory
Memory
You
You need to be the person who answers the CPU’s “What next?” question. But it would be
very uncomfortable to shrink you down to 5mm tall and insert you into the computer just
so you could issue a command three billion times per second. So instead, you must write
down your instructions in advance. We call these stored instructions a program and the act
of writing these instructions down and getting the instructions to be correct programming.
• First you need to know the programming language (Python) - you need to know the
vocabulary and the grammar. You need to be able spell the words in this new lan-
guage properly and how to construct well-formed “sentences” in this new languages.
• Second you need to “tell a story”. In writing a story, you combine words and sen-
tences to convey an idea to the reader. There is a skill and art in constructing the story
and skill in story writing is improved by doing some writing and getting some feed-
back. In programming, our program is the “story” and the problem you are trying to
solve is the “idea”.
Once you learn one programming language such as Python, you will find it much easier to
learn a second programming language such as JavaScript or C++. The new programming
language has very different vocabulary and grammar but once you learn problem solving
skills, they will be the same across all programming languages.
You will learn the “vocabulary” and “sentences” of Python pretty quickly. It will take
longer for you to be able to write a coherent program to solve a brand new problem. We
teach programming much like we teach writing. We start reading and explaining programs
and then we write simple programs and then write increasingly complex programs over
time. At some point you “get your muse” and see the patterns on your own and can see
more naturally how to take a problem and write a program that solves that problem. And
once you get to that point, programming becomes a very pleasant and creative process.
We start with the vocabulary and structure of Python programs. Be patient as the simple
examples remind you of when you started reading for the first time.
Two kinds of programs process high-level languages into low-level languages: inter-
preters and compilers. An interpreter reads a high-level program and executes it, meaning
that it does what the program says. It processes the program a little at a time, alternately
reading lines and performing computations.
A compiler reads the program and translates it completely before the program starts run-
ning. In this context, the high-level program is called the source code, and the translated
program is called the object code, machine code or the executable. Once a program is
compiled, you can execute it repeatedly without further translation.
>>> 1 + 1
2
>>>
The chevron, >>>, is the prompt the interpreter uses to indicate that it is ready. If you type
1 + 1, the interpreter replies 2. The chevron is the Python interpreter’s way of asking you,
“What do you want me to do next?”. You will notice that as soon as Python finishes one
statement it immediately is ready for you to type another statement.
Typing commands into the Python interpreter is a great way to experiment with Python’s
features, but it is a bad way to type in many commands to solve a more complex problem.
When we want to write a program, we use a text editor to write the Python instructions into
a file, which is called a script. By convention, Python scripts have names that end with
.py.
To execute the script, you have to tell the interpreter the name of the file. In a UNIX or
Windows command window, you would type python dinsdale.py. In other development
environments, the details of executing scripts are different. You can find instructions for
your environment at the Python Website python.org.
1.5. What is a program? 7
Working in interactive mode is convenient for testing small pieces of code because you can
type and execute them immediately. But for anything more than a few lines, you should
save your code as a script so you can modify and execute it in the future.
The details look different in different languages, but a few basic instructions appear in just
about every language:
input: Get data from the keyboard, a file, or some other device, pausing if necessary.
output: Display data on the screen or send data to a file or other device.
sequential execution: Perform statements one after another in the order they are encoun-
tered in the script.
conditional execution: Check for certain conditions and execute or skip a sequence of
statements.
repeated execution: Perform some set of statements repeatedly, usually with some varia-
tion.
reuse: Write a set of instructions once and give them a name and then reuse those instruc-
tions as needed throughout your program.
Believe it or not, that’s pretty much all there is to it. Every program you’ve ever used, no
matter how complicated, is made up of instructions that look pretty much like these. So you
can think of programming as the process of breaking a large, complex task into smaller and
smaller subtasks until the subtasks are simple enough to be performed with one of these
basic instructions.
Three kinds of errors can occur in a program: syntax errors, runtime errors, and semantic
errors. It is useful to distinguish between them in order to track them down more quickly.
8 Chapter 1. Why should you learn to write programs?
can predict the result of the modification, and you take a step closer to a working program.
If your hypothesis was wrong, you have to come up with a new one. As Sherlock Holmes
pointed out, “When you have eliminated the impossible, whatever remains, however im-
probable, must be the truth.” (A. Conan Doyle, The Sign of Four)
For some people, programming and debugging are the same thing. That is, programming
is the process of gradually debugging a program until it does what you want. The idea is
that you should start with a program that does something and make small modifications,
debugging them as you go, so that you always have a working program.
For example, Linux is an operating system that contains thousands of lines of code, but it
started out as a simple program Linus Torvalds used to explore the Intel 80386 chip. Ac-
cording to Larry Greenfield, “One of Linus’s earlier projects was a program that would
switch between printing AAAA and BBBB. This later evolved to Linux.” (The Linux
Users’ Guide Beta Version 1).
Later chapters will make more suggestions about debugging and other programming prac-
tices.
Formal languages tend to have strict rules about syntax. For example, 3 + 3 = 6 is a syntac-
tically correct mathematical statement, but 3 + +3@6 is not. H2 O is a syntactically correct
chemical formula, but 2 Zz is not.
Syntax rules come in two flavors, pertaining to tokens and structure. Tokens are the basic
elements of the language, such as words, numbers, and chemical elements. One of the
problems with 3 + +3@6 is that @ is not a legal token in mathematics (at least as far as I
know). Similarly, 2 Zz is not legal because there is no element with the abbreviation Zz.
The second type of syntax error pertains to the structure of a statement; that is, the way the
tokens are arranged. The statement 3 + +3@6 is illegal because even though + is a legal
Random documents with unrelated
content Scribd suggests to you:
'Oh, nonsense, she will be there readily enough,' said her father; adding
—'I think I may be pardoned for saying it, Mr. Wilmot, but my Bella will be
the belle of the ball. However, leave us just now, dear. Mr. Wilmot has come
to see me on business, I doubt not, and that won't be interesting to you.'
She at once took up her work-basket, and withdrew, with a bow and a
smile, and Jerry, as his gaze followed her, and he saw what a perfect
creature she was, so slim and graceful with the pure complexion that comes
of health and country air, soft and sparkling brown eyes and rich hair coiled
round a shapely head, thought how unworthy it was of his mother to view
the girl as she did, and to treat her as she had hitherto done.
He knew exactly from what her indecision about the ball sprang. Never
before had she or her father been invited to the Manor House when other
guests were there, at dinner or garden parties, and when they had dined with
her and Miss Wilmot, in solitary state, she always resented bitterly the airs
of patronage which Lady Julia adopted.
'She's going to the ball, never fear, Mr. Jerry, and there is her reply on
the mantel-piece,' said her father.
'And, now through the medium of some brandy and water, we shall turn
to business matters.'
'Glad to hear you say so,' replied Jerry; 'I have wished much to see you,
Chevenix, about money matters.'
Mr. Chevenix smiled faintly, and coughed slightly behind his hand.
'How has it been that of late so little has been paid into my bank
account,' said Jerry, 'and that I have had such difficulty in squaring matters
at Aldershot; even in meeting my losses on the last Divisional Steeplechase,
and in many other things; that in fact both the mater and myself are often
short of the "ready"?'
'The estate, you are aware, was heavily mortgaged by your late worthy
father.'
'I have heard that a hundred times, and know it to my cost,' replied
Jerry, impatiently.
'And since you joined the army you must also be aware that, to meet the
many requirements of yourself and Lady Julia, I have had to effect other
mortgages, for instance, on Langley Park (which my forefathers farmed
under yours for more than two centuries), on the forty acres of Upton Stoke,
and on Hazelwood; that, in short, all these may never be yours again, as I
see no way of your removing these encumbrances, save by a wealthy
marriage; and that the good lady, your mother, has not the slightest idea of
the extent of the evil and all your liabilities.'
'The devil!' exclaimed Jerry, 'these are pleasant things to listen to.'
There was a silence between them for a time, and Jerry took a long sip
at his brandy and seltzer. With all his admiration and certainly growing love
for the handsome Bella, she seemed to be receding from him in the distance
now.
'I am deeply sorry to tell you these things, Mr. Wilmot,' said Chevenix,
who had genuine respect and love for the listener, and really had the well-
being of the old family at heart; 'it is a serious thing for a young man like
you, the inheritor of a good old name, bred with expensive tastes and so
forth, to find yourself hampered and trammelled thus at your very outset of
life, but so it is.'
'We live and learn, Mr. Chevenix,' said Jerry, with unusual bitterness for
him.
'We live and learn, but not the wiser grow, says John Pomfret.'
Jerry sat staring into the fire as if bewildered by the sudden revelation—
this new state of things.
'And who holds all the infernal mortgages?' asked Jerry, abruptly.
'You; and who advanced all this money to my father, and to myself
latterly?'
'I did—every shilling to the old squire and to you, Mr. Jerry; but do not
be alarmed—do not be alarmed—I have no intention of foreclosing.'
Jerry was more thunderstruck than ever. Here was another startling
revelation. He found that more than half of his paternal estate was in the
hands of the very man whose daughter he had been learning to love in
secret, and whom his proud mother so heartily disliked and publicly
slighted.
Bella, the daughter of the village attorney, 'the lawyer man,' as Lady
Julia called him, whose forefathers did yeoman service to his, and farmed
old Langley Park.
'Take courage—you have yet time to look about you, and money, if it
can be procured from some other source, may repair these evils,' said Mr.
Chevenix, kindly; but he knew not what was then in Jerry's mind. That in
reality a love for Bella had been fast becoming the ruling thought of his life;
that on learning she had returned to Wilmothurst he had arranged to return
home also, and had made up his mind, despite his mother's pride and
opposition, to propose for the girl; but dared he do so now?
Their positions were completely reversed, and were he to do so she
would never believe in his love or view him as other than a pretender, who
offered it in barter for the mortgages her father held on his estate.
The latter was eyeing Jerry, and, having no idea of what his secret
thoughts were, failed to see why, if even a half of his estate remained, he
should seem so suddenly overcome, for he had grown very pale, and he
respired like one in pain.
To thrust all love for Bella out of his heart was now the bitter task to
which he must set himself, and perhaps to replace her image by one of the
many heiresses to whom his mother so often drew his attention; but that
could not be. Jolly, good-hearted Jerry would never condescend to be
mercenary; he felt that he would rather a thousand times share poverty with
a loving little girl like Bella than wealth with another. Matters had not yet
come to poverty—far from it; but now, and after all that had transpired, and
he had learned who the holder of these fatal mortgages was, how could he
speak to her or her father of love or marriage without being most cruelly
and degradingly misunderstood, and having his object utterly misconstrued?
'Making matters worse and worse. It was six per cent. on Langley Park,
Mr. Chevenix, and that is stiff interest as things go.'
'Yes, it was.'
'Yes.'
'Worse and worse,' assented Mr. Chevenix, shaking his white head. 'But
bear up, my dear boy. I may call you so?' added the old man, kindly patting
Jerry's shoulder. 'Money will pull you through. A handsome young fellow
like you, with your family prestige, will easily find a rich wife, and an
officer has a hundred chances of success when other fellows have none.'
Jerry had not the heart to ask what the total sum of his liabilities
amounted to, and rose to depart.
'Bid Miss Chevenix good-bye for me,' said he, as he departed in haste,
having just then no desire to add to the intense mortification that crushed
him by looking again on the bright face of the unconscious Bella—for
unconscious she was of what their mutual monetary relations were till her
father some time after informed her, when the news came to her perhaps too
late.
Sunk in thoughts too bitter for words, Jerry rode slowly home through
the dusk of the gloomy winter evening. The barriers raised by evil fortune,
and added to by a sense of honour and propriety, enhanced in his eyes the
value of the girl he felt that he had lost, and rendered dearer to him the
hopes he had been cherishing of late, and which had become so precious to
him.
He longed for the society and advice of Goring over a 'quiet weed' to
talk about these things ere he confided the state of matters to his mother,
who, with all her great love of him, he feared could not be brought to see
how matters stood with regard to the estate and the encumbrances thereon.
'Yes, mother.'
'Yes; his daughter is coming to the ball. Here is her reply; I brought it
with me,' said he, with an irrepressible sigh.
'Of course she will come; who ever doubted it?' responded Lady Julia,
as she somewhat contemptuously tossed Bella's unopened note into the fire;
and Jerry turned away to join Goring and his cousin Emily, who were
looking over a portfolio of prints upon a stand of gilded wood.
To Jerry it seemed that ere long his mother might have to betake herself
to Bruges or Boulogne to retrench, while he might have to exchange for
India if the route came not speedily for Africa.
Bevil Goring, when they were alone, heard with genuine concern the
state of affairs as Jerry set them before him, and agreed with him that to
continue his attentions to Miss Chevenix would lead to an entire
misconstruction on the part of herself and her father as to the true state of
his heart, and lead them to infer that he was only a fortune-hunter; and
honest Jerry blushed scarlet at the name, and twirled and gnawed his
moustache with intense irritation.
'The state of our—or rather your—affairs, as this man has set them
before you, Jerry,' said Lady Julia, 'now renders it absolutely necessary that
you should marry for money, and that at once.'
'Emigrate!'
'Invest in a pickaxe and spade, and try Ballarat or the Diamond Fields.'
'How can you jest thus?' said his mother, loftily.
'To me the nearest heiress seems to be Bella Chevenix,' said Jerry, not
unwilling to revenge her for the slighting remarks his mother daily made.
'She has a fortune certainly—a fortune won by advances made upon our
lands—but of what use can it be to her, brought up, as she has been,
ignorant of the habits, the tastes, and requirements of our class?'
'She is ignorant of none, and enjoys them all,' replied Jerry, with some
asperity.
'We are going to fight King Koffee, they say. I'll get taken prisoner, and
marry his youngest daughter!' cried Jerry, with a gleam of his old
recklessness.
For some days now he did not go near Bella Chevenix, who began to
feel a little wroth at him in consequence, as she had no key as yet to what
influenced Jerry.
'Their ball!' exclaimed the proud girl, petulantly; 'I am not sure that I
should go, papa, to be patronised and slighted perhaps.'
But the desire to appear where she knew she would shine prevailed over
all her doubts, and she devoted all her energies to have a costume that
should be second to none.
Yet Jerry was further now from disclosing himself than ever, and Bella
seemed in no hurry for him to do so, for she was young enough—even after
all she had seen of society—to shrink from a declaration, for to a girl there
is something so seductive, so sweet in hovering on the brink, when she, as
Bella did in her secret heart, loves the man.
Cousin Emily was not slow in discovering the direction in which Jerry
so often turned his horse's head, and hinted thereof to Lady Julia.
'But for the dangers my poor boy will have to encounter,' said the latter,
'I would hail with pleasure his departure to the coast of Africa, as a useful
means of separating him from this most artful creature.'
CHAPTER XX.
THE FIREFLY.
The red sun of a clear winter day was shining on the two chalky
eminences at the embouchure of the Arques, or Bethune, and on the low
tongue of land between them, whereon is situated the seaport of Dieppe in
Normandy, from the church of which the coast of England can be distinctly
seen, when the Firefly, which really was a beautiful yacht, crept slowly
along on a wind under the lee of the shore, from which she was rather more
than a mile distant.
She was a taut-rigged craft of about two hundred tons, and whether one
regarded the crew, the fitting of the rigging, or the cut of the sails, it was
evident that in skilful hands she could do anything. For a Cowes yacht she
was curiously rigged, being a hermaphrodite—brig forward and schooner
aft. Her foremast, like her bowsprit, was strong and heavy, her mainmast
long and tapering. Her upper spars were slender and light, with topmast,
topgallant mast, and royal mast, all like slender wands, yet capable of
carrying a great amount of canvas. Her flush deck was white as the driven
snow, and she had eight six pounders, all brass, and polished like gold—
bright as the copper with which she was sheathed to the bends.
Such was the craft on board of which Alison Cheyne found herself a
species of prisoner, and compelled to take a part in an erratic and apparently
a purposeless cruise. To sail for Madeira had been the first intention of Lord
Cadbury, when Slagg, by his direction, inserted in the newspapers a
paragraph to the effect that he had gone to the Mediterranean—a paragraph
expressly designed to mislead Bevil Goring; but heavy head-winds had
prevailed, and after hanging about in 'the Chops of the Channel' for a week
and more, the Firefly was standing northward along the coast of France.
He certainly thought the season a strange one for a cruise; and as for Mr.
Gaskins, Cadbury's groom and chief valet, he utterly loathed the whole
expedition, and, connecting it shrewdly in some way with Miss Cheyne, he
hated her with a most unholy hatred.
To Tom Llanyard she was a new experience; she was so totally unlike
any other of her sex he had seen on board the Firefly; and he had—we are
sorry to say—seen many that were rather remarkable.
The weather had been rough, and the poor girl, who had suffered much
from sea sickness, of a necessity remained below; while her luckless
attendant, Daisy Prune, was utterly prostrated by the same ailment, and the
order of things was now reversed, for Alison had to attend upon her. The
presence of Daisy, however, was a source of protection to the former, as it
saved her from much of the attention of Cadbury, who had hoped that great
events might be developed or achieved by the sea voyage.
Alison's freshness was delightful to the coarse, jaded man of the world,
who, tired at last of extravagant and congenial dissipation (that would have
horrified his worthy father the Alderman of Threadneedle Street), thought
now of trying domestic felicity, pour se désennuyer; and truly Alison was so
unlike most of the other women he had known, or whose acquaintance he
had chosen to cultivate, that the present opportunity gave him great
expectations of the future.
He actually reckoned upon a safe conquest, now that he had her all to
himself; and so far as Sir Ranald was concerned, while piling kindnesses
upon him, and pressing upon him also the best wines that the cellar of
Cadbury Court offered, he would not have been sorry had a gale of wind
blown the pompous old baronet overboard, and left Alison alone in the
world—alone, and at his mercy!
How sad and fair, young and pure, she looked in all the brightness of
her beauty, as her head rested against the crimson back of the cushioned
locker or sofa on which she was seated in an attitude expressive of utter
weariness of heart.
'Alison,' said he, attempting to take her hand.
Her eyes flashed now, and her proud little lip curled, as she said, 'Lord
Cadbury, when did I give you permission to call me—as papa does—by my
Christian name?'
'Why do you Lord me?' he asked; 'I would you called me—Timothy,' he
added, rather faintly; and at this absurd name a little smile flickered on
Alison's pale face, and a gesture of impatience escaped her, as she knew
that she was about to be subjected to some more of his odious and weary
love-making.
'My passion for you made me so modest and diffident,' said he (though
in reality it was his years), 'that I addressed myself first to your father,
though you were well aware of the sweet hopes I fostered in my heart,
Alison.'
'I can scarcely believe that your decision is final—that you are in
earnest with me.'
'Earnest! Do you imagine, sir, that I would jest in this matter, and—and
with you?' she exclaimed, becoming—with all her native gentleness—
tremulous with suppressed passion.
'What, Alison?'
'Yes.'
'You led me to believe when we quitted Chilcote in such hot haste that
instant flight alone in this vessel would save papa from arrest through
certain bills which he says he saw you destroy. So you and he—he,' she
added, with a heavy sob—'have both deceived me, and now I believe
neither of you. It was a vile trick on the part of you both to separate me
from Captain Goring.'
Cadbury had reckoned at least upon her gratitude for taking up the bills
of Slagg, as he had to some extent won that of her father; but even this plan
failed to serve him, and so far as Alison was concerned he might as well
have thrown his money into the sea. The name of his rival on her lips
infuriated him, and he tugged at his long, white horse-shoe moustache
viciously, as he thought that he had played what he deemed his trump card,
and yet lost after all!
He felt that he acted wisely to his daughter in leaguing with the wealthy
peer against her; yet, over and above all, he loved her dearly and tenderly;
and amid all this was an undying hostility to Bevil Goring, whom he
deemed the real cause of all this opposition to their wishes, and
consequently the present trouble, turmoil, and unnecessary voyaging in
rough and wintry weather.
Though it was a relief, without doubt, to be away now beyond the reach
or ken of the hook-nosed or vulture-eyed money-lenders, who, like Slagg,
had long possessed, among their ofttimes hopelessly-regarded assets, his
bills and acceptances.
He saw she looked pale, very pale indeed; but that, of course, he
attributed to the mal de mer; but as for love, no one, he believed, ever
sickened or died of that. A long separation was the surest and best cure.
'And I repeat that in these days of ours,' he continued, 'it is, or ought to
be, the object of both men and women to marry well.'
'That is, to marry for money,' said Alison.
'Yes; if a girl has beauty and birth, but not money, she should look for
some one who has that more than necessary element towards our very
existence. If she has money with both these attributes, she should look for
something more.'
'More, papa?'
'Yes, she should look for that which a poor girl seldom or never has
offered her.'
'A title.'
'In fact, in any way or every way to sell herself to the highest bidder.
Oh, what a selfish code!' exclaimed the girl, with great bitterness of heart.
'Did the Cheynes of Essilmont always do this?'
'What?'
'Beggars!' replied her father, with equal bitterness of heart, for his was
naturally a proud one; 'but, as Lever says, "the world makes us many things
we never meant to be."'
'Do you forget, papa, that marriage is a sacrament, and that without a
full and perfect consent it is in reality no marriage at all, and should not be
binding, even though the blessing were given by the Archbishop of
Canterbury.'
'What do you mean, Alison?' asked her father, surprised alike by her
tone and this theory.
Sir Ranald became silent. He had never seen her in this mood before;
and he, of course, ascribed it to 'the fatal influence that fellow Goring had
obtained over her mind.'
So this conversation ended; but the interview with her father and that
with Cadbury are but examples of many with which she was tormented
daily ad nauseam.
Alison ere long had fresh food for sorrow given to her, when a pilot
boat brought off to the Firefly some London papers, and in these she was
informed—as if by chance—there were rumours of the fast approaching
war in Africa, and she saw the glances, most meaning glances, of
satisfaction that were exchanged by her father and Lord Cadbury, on its
being announced that among the troops detailed for service in the field
under Sir Garnet Wolseley was the regiment of Bevil Goring; and so a
double and more terrible separation—perhaps a final and fatal one—was
before them, and the heart of the poor girl seemed to fill with tears as she
read and re-read the startling paragraph.
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
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.
ebookname.com