(PDF Download) A Beginners Guide To Python 3 Programming 2nd Edition John Hunt Fulll Chapter
(PDF Download) A Beginners Guide To Python 3 Programming 2nd Edition John Hunt Fulll Chapter
https://ebookmass.com/product/a-beginners-guide-
to-python-3-programming-2nd-edition-john-hunt/
OR CLICK BUTTON
DOWLOAD NOW
https://ebookmass.com/product/advanced-guide-to-
python-3-programming-2nd-2nd-edition-john-hunt/
https://ebookmass.com/product/python-for-beginners-master-python-
programming-from-basics-to-advanced-level-tim-simon/
https://ebookmass.com/product/python-programming-for-
beginners-2-books-in-1-the-ultimate-step-by-step-guide-to-learn-
python-programming-quickly-with-practical-exercises-mark-reed/
PYTHON PROGRAMMING: 3 MANUSCRIPTS CRASH COURSE CODI
WITH PYTHON DATA SCIENCE. THE STEP BY STEP GUIDE FOR
BEGINNERS TO MASTER SOFTWARE PROJECTS, ALGORITHMS,
TRICKS AND TIPS Tacke
https://ebookmass.com/product/python-programming-3-manuscripts-
crash-course-coding-with-python-data-science-the-step-by-step-
guide-for-beginners-to-master-software-projects-algorithms-
tricks-and-tips-tacke/
https://ebookmass.com/product/python-programming-3-books-
in-1-ultimate-beginners-intermediate-advanced-guide-to-learn-
python-step-by-step/
https://ebookmass.com/product/micropython-for-the-internet-of-
things-a-beginners-guide-to-programming-with-python-on-
microcontrollers-2nd-edition-bell/
https://ebookmass.com/product/modern-c-for-absolute-beginners-a-
friendly-introduction-to-the-c-programming-language-2nd-edition-
slobodan-dmitrovic/
https://ebookmass.com/product/learning-scientific-programming-
with-python-2nd-edition-christian-hill-2/
Undergraduate Topics in Computer Science
John Hunt
A Beginners
Guide to Python 3
Programming
Second Edition
Undergraduate Topics in Computer Science
Series Editor
Ian Mackie, University of Sussex, Brighton, UK
Advisory Editors
Samson Abramsky , Department of Computer Science, University of Oxford,
Oxford, UK
Chris Hankin , Department of Computing, Imperial College London, London,
UK
Mike Hinchey , Lero – The Irish Software Research Centre, University of
Limerick, Limerick, Ireland
Dexter C. Kozen, Department of Computer Science, Cornell University, Ithaca,
NY, USA
Andrew Pitts , Department of Computer Science and Technology, University of
Cambridge, Cambridge, UK
Hanne Riis Nielson , Department of Applied Mathematics and Computer
Science, Technical University of Denmark, Kongens Lyngby, Denmark
Steven S. Skiena, Department of Computer Science, Stony Brook University, Stony
Brook, NY, USA
Iain Stewart , Department of Computer Science, Durham University, Durham,
UK
Joseph Migga Kizza, College of Engineering and Computer Science, The
University of Tennessee-Chattanooga, Chattanooga, TN, USA
‘Undergraduate Topics in Computer Science’ (UTiCS) delivers high-quality instruc-
tional content for undergraduates studying in all areas of computing and information
science. From core foundational and theoretical material to final-year topics and
applications, UTiCS books take a fresh, concise, and modern approach and are ideal
for self-study or for a one- or two-semester course. The texts are all authored by
established experts in their fields, reviewed by an international advisory board, and
contain numerous examples and problems, many of which include fully worked
solutions.
The UTiCS concept relies on high-quality, concise books in softback format, and
generally a maximum of 275–300 pages. For undergraduate textbooks that are likely
to be longer, more expository, Springer continues to offer the highly regarded Texts
in Computer Science series, to which we refer potential authors.
John Hunt
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of
the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology
now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication
does not imply, even in the absence of a specific statement, that such names are exempt from the relevant
protective laws and regulations and therefore free for general use.
The publisher, the authors, and the editors are safe to assume that the advice and information in this book
are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or
the editors give a warranty, expressed or implied, with respect to the material contained herein or for any
errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Springer imprint is published by the registered company Springer Nature Switzerland AG
The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
This book is simply for Denise, the love of my
life.
Preface the Second Edition
I am writing this preface to the second edition of this book in the middle of 2023,
and I am reflecting on what has happened to Python over the last 4 to 5 years.
Python itself has gone from strength to strength, its popularity has not diminished
and if anything has increased. I increasingly come across organizations in all walks
of life that are actively using the language. This is true whether they are schools,
colleges or universities, charities, governmental organization, research institutions
or commercial enterprises. The uses being made of Python keeps on growing and
the ecosystem of supporting libraries available keeps on growing.
This edition represents a significant update from Python 3.7 (which was the current
version when the first edition of the book was written) to Python 3.11 (and a look
ahead to Python 3.12). It also represents a significant extension to the original book
with an additional eight chapters. These chapters represent topics and questions that
those learning Python have expressed an interest in such as frozensets, enumer-
ated types and sorting functions to Python virtual environments. It also reflects new
features in the language such as pattern matching introduced in Python 3.10 and
Exception Groups handling and Exception Notes introduced in Python 3.11.
The book also now includes a chapter entitled ‘Python Bites Back’ which high-
lights for someone learning Python, 14 of the most common mistakes made by a
Python beginner. This chapter can be dropped into at any time but covers the whole
of the language discussed in this book so some sections may be more relevant once
the whole book has been read.
vii
Preface to the First Edition
There is currently huge interest in the Python programming language. This is driven
by several factors; its use in schools with the Raspberry Pi platform, its ability to be
used for DevOps scripts, its use in Data Science and Machine Learning and of course
the language itself. Plus of course it is free! So anyone anywhere can download and
install Python and get started.
There are many books on Python; however, most assume previous programming
experience or are focused on particular aspects of Python use such as Data Science
or Machine Learning or have a scientific flavor.
The aim of this book is to introduce Python to those with little or very little
programming knowledge, but to take them through to become an experienced Python
developer.
As such the earlier parts of the book introduce fundamental concepts such as
what a variable is and how a for loop works. In contrast the later chapters intro-
duce advanced concepts such as Functional Programming, object orientation and
exception handling.
In between a wide range of topics are introduced and discussed from a Python
point of view including functions, recursion, operators, Python properties, modules
and packages, protocols and monkey patching, etc.
After the core elements of Python are established each new subject area is intro-
duced by way of an introductory chapter presenting the topic in general, providing
background on that subject, why it is of importance, etc. These introductions cover
structure analysis, functional programming and object orientation.
Some of the key aspects of this book are:
1. It assumes very little knowledge or experience of Python or programming.
2. It provides a basic introduction to Python as well as advanced topics such as
generators and coroutines.
3. This book provides extensive coverage of object orientation and the features in
Python 3 supporting classes, inheritance and protocols.
4. Pythons’ support for functional programming is also presented.
ix
x Preface to the First Edition
Chapter Organization
Each chapter has a brief introduction, the main body of the chapter, followed by a
list of (typically) online references that can be used for further reading.
Following this there is typically an Exercises section that lists one or more
exercises that build on the skills you will have learnt in that chapter.
Sample solutions to the exercises are available in a GitHub online repository that
supports this book.
You can of course just read this book; however following the examples in this book
will ensure that you get as much as possible out of the content.
For this you will need a computer.
Python is a cross platform programming language and as such you can use Python
on a Windows PC, a Linux box or a Apple Mac, etc. So you are not tied to a particular
type of operating system; you can use whatever you have available.
However you will need to install some software on that computer. At a minimum
you will need Python.
This book focuses on Python 3 so you will need that. Some guidance on this is
provided in Chap. 2 on setting up your environment.
You will also need some form of editor in which to write your programs. There
are numerous generic programming editors available for different operating systems
with VIM on Linux, Notepad++ on Windows and Sublime Text on Windows and
Macs being popular choices.
However, using a Integrated Development Environment (IDE) editor such as
PyCharm or potential Visual Studio Code will make writing and running your
programs much easier.
Preface to the First Edition xi
Using an IDE
The IDE I prefer for Python is PyCharm, it is not the only IDE for Python by any
means, but it is a very widely used one.
Other IDEs available for Python include:
● Spyder which is an IDE often used by scientists and engineers see https://www.
spyder-ide.org/.
● Jupiter Notebook which is a web-based IDE and is particularly good for data
scientists https://jupyter.org/.
● Visual Studio Code. This is a very good free editor from Microsoft that has really
useful features https://code.visualstudio.com.
● Sublime Text is more of a text editor that color codes Python; however for a simple
project it may be all you need https://www.sublimetext.com.
Mostly this book is editor or IDE agnostic only Chap. 3 ‘Setting up the Python
Environment’ and Chap. 42 ‘Python Virtual Environments’ really focus on PyCharm.
You can therefore use whatever editor you wish to use.
Conventions
Throughout this book you will find a number of conventions used for text styles.
These text styles distinguish different kinds of information.
Code words, variables and Python values, used within the main body of the text,
are shown using a Courier font. For example:
This program creates a top level window (the wx.Frame) and gives it a title. It also creates
a label (a wx.StaticText object) to be displayed within the frame.
The examples used in this book (along with sample solutions for the exercises at the
end of most chapters) are available in a GitHub repository. GitHub provides a web
interface and a server environment hosting Git.
Git is a version control system typically used to manage source code files (such
as those used to create systems in programming languages such as Python but also
Java, C#, C++, Scala, etc.). Systems such as Git are very useful for collaborative
development as they allow multiple people to work on an implementation and to
merge their work together. They also provide a useful historical view of the code
(which also allows developers to roll back changes if modifications prove to be
unsuitable).
If you already have Git installed on your computer then you can clone (obtain a
copy of) the repository locally using:
git clone https://github.com/johnehunt/beginnerspython
3_2nd
If you do not have git then you can obtain a zip file of the examples using
https://github.com/johnehunt/beginnerspython3_2nd/arc
hive/master.zip
You can of course install Git yourself if you wish. To do this see https://git-scm.
com/downloads. Versions of the Git client for Mac OS, Windows and Linux/Unix
are available here.
However, many IDEs such as PyCharm come with Git support and so offer another
approach to obtaining a Git repository.
For more information on Git see http://git-scm.com/doc. This Git guide provides
a very good primer and is highly recommended.
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 What is Python? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Python Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Python History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Python Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Python Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 Python Execution Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 Running Python Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.7.1 Interactively Using the Python Interpreter . . . . . . . . . . 6
1.7.2 Running a Python File . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.7.3 Executing a Python Script . . . . . . . . . . . . . . . . . . . . . . . 9
1.7.4 Using Python in an IDE . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.8 Jupyter Notebooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.9 Useful Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2 Where is Python Used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1.1 Data Analytics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1.2 Machine Learning and AI . . . . . . . . . . . . . . . . . . . . . . . . 17
2.1.3 Database Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1.4 Python for Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.1.5 Python for Film Making . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.1.6 Cross Platform UIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.1.7 Games Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.1.8 Integration Testing Framework . . . . . . . . . . . . . . . . . . . 20
2.1.9 Academic Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.1.10 Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.2 Useful Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
xiii
xiv Contents
the Python community; it is also responsible for various processes within the Python
community, including developing the core Python distribution, managing intellectual
rights and supporting developer conferences including PyCon.
There is now one main version of Python, that is Python 3. However, until the start
of 2020 there were two main supported versions in circulation one called Python 2
as well as Python 3.
● Python 2 was launched in October 2000 and was very widely used. Support for
this version of Python ended on the 1st of January 2020. However, you will
still find examples of code, libraries and tutorials that focus on this version of
the language. This is particularly true of the web so be careful when browser for
examples or help—make sure they relate to Python 3. The more current the article
or suggestion you are looking the more likely that it is Python 3.
● Python 3 was launched in December 2008 and is a major revision to the language
that is not backward compatible. It is current the most widely used version of the
language and represents the version we will use throughout this book.
The issue between the two versions can be highlighted by the simple print facility:
● In Python 2 this is written as print ‘Hello World’
● In Python 3 this is written as print(‘Hello World’)
It may not look like much of a difference but the inclusion of the ‘()’ marks a major
change and means that any code written for one version of Python will probably not
run on the other version. There are tools available, such as the 2–3 utility, that will
(partially) automate translation from Python 2 to Python 3 but in general you are still
left with significant work to do.
A survey of Python Developers carried out by JetBrains (the organization behind
the PyCharm editor) in 2022 found that only 2% of developers now claimed to be
using a Python 2.x version, with 2% unsure which version they used. The rest (96%)
were using a version of the 3.x line mostly 3.8, 3.9 or 3.10. This survey was completed
before 3.11 was made available, and this over 70% of developers were using one of
the three most recent versions of Python. For more information see https://www.jet
brains.com/lp/devecosystem-2022/python/.
Python 3 is the future of the Python language, and it is this version that has
introduced many of the new and improved language and library features (that have
admittedly been back ported to Python 2 in many cases). This book is solely focused
on Python 3.
In the remainder of this book when we refer to Python we will always be referring
to Python 3. Since then there have been numerous point and sub point releases, for
example, as well as Python 3.1, 3.2, etc. there have also been intermediate releases
such as 3.1.1, 3.1.2, etc.
1.3 Python History 3
As has been said, Python has been around along time, although for some people
it can seem like Python was an overnight success. In fact Python originates from
the very late 1980s when Guido Van Possum started implementing the first version
of Python. The first release of Python was on 20th February 1991. Guido actually
remained the lead developer on Python until 12 July 2018 when he stepped down as
the “benevolent dictator” of Python. Since January 2019 there has been a five-member
Steering Council that leads the Python project.
Python 2.0 was initially released on October 16th 2000 with its end of life being
the 1st of January 2020. Python 3.0 was initially released 3rd December 2008.
It is worth noting that in the Python World, the major version number represents
an epoch (such that there has been a Python 1, a Python 2 and a Python 3 epoch).
Within this each Python 3 release has a prefix of 3.1, thus 3.1 was the second Python
3 release, etc. This differs from many other programming language such as Java with
Java 18 or Java 19 being the equivalent of 3.11 and 3.12 in Python, etc. The Python
organization does not always release a new version of Python each year, although
recent releases have tended to be yearly. However, although the language is evolving
many of these releases do not represent major changes to the language, and thus there
is relatively little difference between Python 3.10 and Python 3.11 for example. A
quick history of the main Python 3 releases is give below:
● Python 3.0 released 3rd December 2008
● Python 3.1 released 27th June 2009
● Python 3.2 released 20th February 2011
● Python 3.3 released 29th September 2012
● Python 3.4 16th March 2014
● Python 3.5 13th September 2015
● Python 3.6 23rd December 2016
● Python 3.7 27th June 2018
● Python 3.8 14th October 2019
● Python 3.9 5th October 2020
● Python 3.10 4th October 2021
● Python 3.11 24th October 2022.
In general almost all of the features in the book are supported by Python 3.8
onwards. One or two of the features require a later version such as 3.10. Such require-
ments will be noted when each topic is introduced. Personally when teaching Python
I try and use the latest stable version such as 3.11 or 3.12.
4 1 Introduction
As well as the core language there are very many libraries available for Python. These
libraries extend the functionality of the language and make it much easier to develop
applications. These libraries cover:
● web frameworks such as Django / Flask,
● email clients such as smtplib (a SMTP email client) and imaplib (an IMAP4 email
client),
● content management operations such as the Zope library,
● lightweight concurrency (running multiple operations at the same time) using the
Stackless library,
● the Generation of Microsoft Excel files using the openpyxl library,
1.6 Python Execution Model 5
Python is not a precompiled language in the way that some other languages you may
have come across are (such as C++ ). Instead it is what is known as an interpreted
language (although even this is not quite accurate). An interpreted language is one
that does not require a separate compilation phase to convert the human readable
format into something that can be executed by a computer. Instead the plain text
version is fed into another program (generally referred to as the interpreter) which
then executes the program for you.
Python actually uses an intermediate model in that it actually converts the plain
text English style Python program into an intermediate ‘pseudo’ machine code format
and it is this intermediate format that is executed. This is illustrated below:
The way in which the Python interpreter processes a Python program is broken
down into several steps. The steps shown here are illustrative (and simplified) but
the general idea is correct.
1. First the program is checked to make sure that it is valid Python, that is a check
is made that the program follows all the rules of the language and that each of
the commands and operations, etc. is understood by the Python environment.
6 1 Introduction
2. It then translates the plain text, English like commands, into a more concise
intermediate format that is easier to execute on a computer. Python can store this
intermediate version in a file which is named after the original file but with a
‘.pyc’ extension instead of a ‘.py’ extension (the ‘c’ in the extension indicates
it contains the compiled version of the code).
3. The compiled intermediate version is then executed by the interpreter.
When this program is rerun the Python interpreter checks to see if a ‘.pyc’ file
is present. If no changes have been made to the source file since the ‘.pyc’ was
created, then the interpreter can skip steps 1 and 2 and immediately run the ‘.pyc’
version of the program.
One interesting aspect of Python’s usage is that it can be (and often is) used in
an interactive fashion, with individual commands being entered and executed one
at a time, with context information being built up. This can be useful in debugging
situations.
There are several ways in which you can run a Python program, including
● Interactively using the Python interpreter.
● Stored in a file and run using the Python command.
● Run as a script file specifying the Python interpreter to use within the script file.
● From within a Python IDE (Integrated Development Environment) such as
PyCharm.
● Using Jupyter Notebooks in a web browser.
It is quite common to find that people will use Python in interactive mode. This uses
the Python REPL (named after Read Evaluate Print Loop style of operation).
Using the REPL, Python statements and expressions can be typed into the Python
prompt and will then be executed directly. The values of variables will be remembered
and may be used later in the session.
To run the Python REPL, Python must have been installed onto the computer
system you are using. Once installed you can open a Command Prompt window
(Windows) or a Terminal window (Mac) and type Python into the prompt. This is
shown for a Windows machine below:
1.7 Running Python Programs 7
In the above example, we interactively typed in several Python commands and the
Python interpreter ‘Read’ what we have typed in, ‘Evaluated ‘it (worked out what
it should do), ‘Printed’ the result and then ‘Looped’ back ready for further input. In
this case we
● Printed out the string ‘Hello World’.
● Added 5 and 4 together and got the result 9.
● Stored the string ‘John’ in a variable called name.
● Printed out the contents of the variable name.
To leave the interactive shell (the REPL) and go back to the console
(the system shell), press Ctrl-Z and then Enter on Windows, or Ctrl-D on OS X
or Linux. Alternatively, you could also issue the command quit().
You should note that once you have left the session anything you created within
the session will be lost.
We can of course store the Python commands into a file. This creates a program file
that can then be run as an argument to the python command. It also allows the
program held within the file to be run many times.
For example, given a file containing the following file (called hello.py) with
the 4 commands in it:
8 1 Introduction
To run the hello.py program on a PC using Windows we can use the Python
command followed by the name of the file:
We can also run the same program on a Apple Mac using MacOS via the Python
interpreter. For example on a Mac we can do the following:
This makes it very easy to create Python programs that can be stored in files and
run when needed on whatever platform is required (Windows, Linux or Mac). This
illustrates the cross platform nature of Python and is just one of the reasons why
Python is so popular.
1.7 Running Python Programs 9
It is also possible to transform a file containing a stored Python program into a Script.
A script is a stand-alone file that can be run directly without the need to (explicitly)
use the python command.
This is done by adding a special line to the start of the Python file that indicates
the Python command (or interpreter) to use with the rest of the file. This line must
start with ‘#!’ and must come at the start of the file.
To convert the previous sections file into a Script we would need to add the path
to the python interpreter. Here path refers to the route that the computer must take to
find the specified Python interpreter (or executable).
The exact location of the Python interpreter on your computer depends on what
options upon selected when you (or whoever installed Python) set it up. Typically
on a Windows PC Python will be found in the ‘Program Files’ directory or it might
be installed in its own ‘Python’ directory.
Whatever the location of the Python interpreter to create a script we will need to
add a first line to our hello.py file. This line must start with a #!. This combination
of characters is known as a shebang and indicates to Linux and other Unix like
operating systems (such as MacOS) how the remainder of the file should be executed.
For example, on a Apple Mac we might add:
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
However, we cannot just run the file as it stands. If we tried to run the file without
any changes then we will get an error indicating that the permission to execute the
file has been denied:
$ ./hello.py
−bash: ./hello.py: Permission denied
$
This is because by default you can’t just run a file. We need to mark it as executable.
There are several ways to do this, however one of the easiest on a Mac or Linux box is
10 1 Introduction
to use the chmod command (which can be used to modify the permissions associated
with the file). To make the file executable we can change the file permissions to include
making it executable by using the following command from a terminal window when
we are in the same directory as the hello.py file:
$ chmod +x hello.py
Where +x indicates that we want to add the executable permission to the file.
Now if we try to run the file directly it executes and the results of the commands
within the file are printed out:
Note the use of the ‘./ ‘ preceding the file name in the above; this is used on Linux
to tell the operating system to look in the current directory for the file to execute.
Different systems will store Python in different locations and thus might need
different first lines, for example on a Linux we might write:
#!/usr/local/bin/python3
print(’Hello, world’)
print(5 + 4)
name = ‘John’
print(name)
By default Windows does not have the same concept. However, to prompt cross
platform portability the Python Launcher for Windows can also support this style of
operation. It allows scripts to indicate a preference for a specific Python version using
the same #! (Shebang) format as Unix style operating systems. We can now indicate
that the rest of the file should be interpreted as a Python script; if multiple versions of
Python are installed this may require Python 3 to be explicitly specified. The launcher
also understands how to translate the Unix version into Windows versions so that /
usr/local/bin/python3 will be interpreted as indicating that python3 is required.
An example of the hello.py script for a Windows or Linux machine is given
below using Notepad++ on a Windows box.
1.7 Running Python Programs 11
When the launcher was installed it should have been associated with Python files
(i.e., files that have a .py extension). This means that if you double-click on one of
these files from the Windows Explorer, then the Python launcher will be used to run
the file.
We can also use an IDE such as PyCharm to writing and execute our Python program.
The same program is shown using PyCharm below:
In the above figure the simple set of commands are again listed in a file called
hello.py. However, the program has been run from within the IDE and the output
is shown in an output console at the bottom of the display.
12 1 Introduction
An approach favored by many data analysts is to use the Jupyter Notebooks infras-
tructure to run Python commands and programs. To do this they use a web browser
which will automatically display graphs and tabular format within the web page
which is very useful in some domains.
Jupyter notebooks have to be installed into your Python environment, for example
using the command
pip install jupyter
You can now type Python statements and expressions into the browser, and the
results generated will be displayed within the browser.
1.9 Useful Resources 13
There are a wide range of resources on the web for Python; we will highlight a few
here that you should bookmark. We will not keep referring to these to avoid repetition
but you can refer back to this section whenever you need to:
● https://en.wikipedia.org/wiki/Python_Software_Foundation Python Software
Foundation.
● https://docs.python.org/3/ The main Python 3 documentation site. It contains
tutorials, library references, set up and installation guides as well as Python
how-tos.
● https://docs.python.org/3/library/index.html A list of all the built-in features for
the Python language—this is where you can find online documentation for the
various class and functions that we will be using throughout this book.
● https://pymotw.com/3/ The Python 3 Module of the week site. This site contains
many, many Python modules with short examples and explanations of what the
modules do. A python module is a library of features that build on and expand
the core Python language. For example, if you are interested in building games
using Python then pyjama is a module specifically designed to make this easier.
● http://www.pythonweekly.com/ is a free weekly summary of the latest Python
articles, projects, videos and upcoming events.
Another random document with
no related content on Scribd:
“The brass pot, you see, was the gentleman,” he said. “He
illustrated the Christian science of self-defence. He didn’t invite an
encounter; but, when it was forced upon him, his art got the better of
the coarser clay.”
He stretched out my arms and pinched their muscles.
“Well enough,” he said; “but that little Antaeus owes his to his
mother earth. He could lick you with one hand, Dicky—easy, he
could. Aren’t you afraid?”
“Yes, I am,” I said, honestly.
He nodded approvingly.
“Real courage, Dicky, doesn’t mean not being afraid. We must all
be afraid sometimes, when we are called upon to fight men or
animals who are much stronger and fiercer than we are. But when
we know that wrong or unjust things are being done to us by people
who do these things just because they are stronger, then, if we fight
them in spite of our being afraid, that is the real courage. On the
other hand, it isn’t brave to force people to fight who we know are
much weaker than we are. But when God has given us good health
and strong arms, it is noble to use them to help people who are
weaker than we are, and to punish the bullies who would take
advantage of their weakness. That’s what it is makes a true
gentleman—not riches, nor titles, nor having a tutor instead of a
public teacher. The little boy who is just, and very truthful, and who
never does anything that he would be ashamed of good people
knowing, is on the way to be a gentleman, whether he lives in a
palace or a cottage. But if, added to these, he trains all his faculties
to oblige other people to repay him the truth and justice and honour
which he gives them, then he is a complete gentleman already.”
He broke off to feel me all up and down.
“There’s good material here,” he said; “very good. We’ll use it to
counterbalance brute strength. That’s the fine moral of boxing, little
man—to see that the weak don’t go to the wall. Now, shall I confess
a secret? I love Harry Harrier pretty equal with you, sir. He’s got the
makings of a gentleman—my sort—in him; only no amount of
persuasion from me will educate him like a scientific licking from one
less than his own size. You don’t see that, perhaps; but, all the
same, I look to you to knock him into my fold for me. You are the
Church’s champion, Richard, and you shall gain me a new convert,
or I’ll never put faith in the gloves again. Now come along with me
home.”
Uncle Jenico received us with surprise, and some consternation
over my appearance; nor did the recital of the affray much reassure
him. Still more was he confounded by the rector’s frank avowal of his
object in approaching him.
“He is a mere child, sir,” said my uncle.
“‘The childhood shows the man,’” quoted the other.
“To be sure. But, as he isn’t going to be a prize-fighter——”
“Every true Christian, sir, is a prize-fighter. He champions the right
in order to win heaven.”
“Well, where was the right here?”
“I regret to have to confess, sir, in an insulting expression about
you, which he very properly resented.”
“Me!” cried my uncle, amazed. Then suddenly he stumped across
to where I stood, and patted my shoulder rather tremulously. “Well,
well,” he said; “no doubt I’m a funny old fellow. So you stood up for
old Uncle Jenico, Dicky?”
His voice shook a little. I wriggled and flushed up crimson.
“It was a lie!” I cried, choking; “and I’m going to fight him and lick
him for it.”
Mr. Sant struck in.
“Broughton rules, sir, I pledge my word.”
“Eh?” said my uncle. “Who’s Broughton, and what does he rule?”
“I mean,” said Mr. Sant, “this little affair shall be conducted strictly
according to the regulations of Broughton, the famous boxer.”
“O!” exclaimed Uncle Jenico, palpably misled by the last word, and
proportionately relieved. “O, to be sure! ‘Mufflers,’ you call ’em, I
think?”
“Yes, yes!” said Mr. Sant, hastily. “A contest of science, sir; no
vulgar hammering;” and he repeated, with warm conviction, his little
dissertation on the true moral courage.
“If Richard, sir, don’t assert himself at the outset,” he ended with, “I
won’t answer for his life here remaining endurable.”
Perhaps this prospect of our moral banishment clinched the matter
with Uncle Jenico, whose attachment to the place was becoming
quite morbid. He stipulated only that the umpire should stop the fight
the moment it might appear I was getting the worst of it. More or less
satisfied on this point, he rubbed his hands, and rallied me on being
the young gamecock I was.
“I’ve given some thought, myself, to a new boxing-glove,” he
confessed; “one with a little gong inside to record the hits, you know.”
Mr. Sant lost no time in taking me in hand. He fashioned me a little
pair of gloves out of some old ones of his own, and gave me half an
hour’s exercise with them every day after lessons. I am not going to
record the process. The result was the important thing.
During all this interval, with the single exception of the morning
following that of my encounter with Harry Harrier, I was left in peace
by the village boys. On that morning, however, I again found myself
in the midst of a little mob of them, who, emboldened by yesterday’s
sport, were come to waylay me after school hours. I was not yet so
proficient as to regard the situation with equanimity; when, behold!
my enemy resolved it for me. He appeared suddenly in the midst, his
knees and elbows in a lively state of agitation. One or two fell away,
protesting, their hands caressing their injured parts.
“Where be a coomen, ’ar-ree!” expostulated one boy, holding his
palm to his ear.
“Mighty!” exclaimed the young ruffler; “bain’t the road free to none
but yourself, Jarge? Here be a yoong gen’lman waiting to pass,
now.”
They took it as aimed at me, and hedged in again. He clawed two
by the napes of their necks, and cracking their heads comfortably
together, flung both aside. His intentions were quite unmistakable,
and his strength a thing to regard. I was painfully conscious of it as I
went through the sullen lane the others, discomfited, made for me;
but I plucked up courage, as I passed, to express my gratitude.
“Thank you, Harry!” I said.
He was after me in a moment.
“It’s not a’going to make no differ’,” he whispered fiercely. “You
onderstand that?”
“It shan’t, anyhow, till after the fight,” I answered back in his ear,
and nodded and ran on.
At last the great day came. Mr. Sant, in order that my uncle might
be saved anxiety, and me the necessity of deception, had given me
no warning until the very moment was on me. He had manœuvred to
hold me a little longer than usual over my lessons; and suddenly
returned to me after a short absence from the room.
“Dick,” he said, “Harrier’s waiting for you in the garden.”
My heart gave a twist, and for a moment pulled the blood out of
my cheeks. Then I saw Mr. Sant looking at me, and was suddenly
glowing all over, as if after a cold douche.
“For the right, Dicky!” he said. “To win your spurs in Christendom!
Remember what I’ve taught you, and keep your head.”
It was all very well to say so, with that part of me like a bladder full
of hot air. But I followed him stoutly, trusting to the occasion to
inspire me with all the science which, for the moment, had clean
deserted me.
There was a little plat of lawn at the back, very snug and private
behind some trees; and here we found my adversary waiting, in
charge of Jacob, the gardener, a grizzled, comfortable old fellow in
complete Christian subjection to his master. Jacob was to second
Harry, and Mr. Sant me. The old fellow grinned and ducked as we
appeared. There were no other witnesses.
“Now,” said Mr. Sant, “when I say ‘Go!’ go; when I call ‘Time!’
stop.”
He fell back with the words, and we stood facing one another. I
was utterly bemused, at that instant, as to the processes by which I
had reached this situation. I could only grasp the one fact that I was
put up to batter, if I could (which seemed ridiculous), this confident,
taut little figure in the shirt and corduroy smalls and gaiters, who held
out, as if for my inspection, two bare brown arms, made all of bone
and whipcord; and that I must proceed to try to do this, without any
present quarrel—but rather the reverse—to stimulate me. It was so
different to the circumstances of that other mad contest. I could have
laughed; I——
“Go!” said Mr. Sant.
Something cracked on my forehead, and I fell.
“Time!” cried Mr. Sant.
He pulled me to my feet.
“Get your wits, Dicky,” he said.
I had got them. The bladder seemed to have burst, and let out all
the hot air. I was quite cool, now, and pretty savage over this
treatment.
“All right, sir,” I said; and I think he understood. He kept me
simmering, however, for the regulation three minutes.
I came up to time now, Broughton’s commendable pupil. The first
round had been, what we call in cricket, a trial ball. This that followed
was the game—muscle and a little science against science and a
little muscle. The brass pot, I am happy to say, prevailed, and sent
the earthenware spinning with a crack on its stubborn little nose.
Jacob mopped the vanquished, who could hardly be kept still to
endure it. As for me, I was cockahoop, crowing inside and out. My
second laughed, and let me go on, warning me only that the battle
wasn’t won.
It was not, indeed. Our bloods were up, and the next round was a
hot test of our qualities. It was give and take, and take and give;
until, lunging under a loose defence, Harry hit me in the wind, and,
while I was gasping and staggering, levelled me to the ground with a
blow on my mouth. He was mad by now, and was rushing to pummel
me, prostrate as I was, when Jacob, with a howl, clutched him and
bore him struggling away.
“Law, ye little warmint!” cried the old man.
“No more of that, Harrier!” said Mr. Sant, from where he was
kneeling, nursing and reviving me; “or I take my man away. To hit
one that’s down, sir! That’s neither Christian nor professional.”
Then he whispered in my ear, “Three minutes, Dicky! Can you do
it? else I’m bound in honour to throw up the sponge.”
There was an agitation in his voice which he tried vainly to control.
I made a desperate effort, and rose as he began to count. I felt a
little sick and wild; but the lesson of over-confidence had gone home.
This time I played warily, tiring out my adversary. At last the moment
came. He struck out furiously, missed, and, as he recovered his
guard, I hit him with all my strength between the eyes. He staggered,
gave a little cry, and, quite blinded for the moment, began to grope
aimlessly with his fists.
“Noo, sir!” howled old Jacob, excited (I am afraid he was an
unsympathetic second); “noo, sir’s your time. Walk in and finish en!”
“I won’t,” I cried. “It isn’t fair. He can’t see.”
Trying to mark me by my voice, the boy let out a furious blow, and,
as his fist whizzed near me, I caught and clutched it in my own.
“Harry!” I said hurriedly, “let’s be friends!”
He tore his hand away, stood with his face quivering a moment,
then all of a sudden fell upon his knees, and, putting his arm across
his eyes, began to sob as if his heart were broken.
A silence and embarrassment fell upon us all. Then Mr. Sant
walked over to the boy and addressed some words to him. He turned
a deaf ear, repulsing him.
“You have fought like a man,” said the clergyman. “Come, take
your beating like one.”
The lad started and looked up. He could see again now, but
glimmeringly.
“Be the three minnuts past?” he said.
“I’m afraid so,” said the other.
The boy got to his feet, sniffing, and, without uttering a word,
began rolling down and buttoning his shirt sleeves.
“There’s a good hot dinner waiting for you inside,” said Mr. Sant.
“Come now, and do the man’s part by it and by us!”
Still he would not speak; but shook his head sullenly, and, fetching
his coat and cap, walked off.
“Humoursome, humoursome!” said old Jacob. “Let en go for a
warmint.”
“No,” said Mr. Sant, rather wistfully. “He’s got the stuff in him. We’ll
have him on our side yet, Richard.”
CHAPTER X.
FRIENDS AT LAST.
When I had been washed, and my cuts and bruises salved, Mr. Sant
took me in to dinner, having already sent a message to my uncle that
I should be late. I was horribly stiff, with blubber lips, and knobs and
swellings everywhere; yet I would not for the world have missed one
pang which my jaws suffered in eating. For was not each twinge an
earnest to me that I was redeemed in my own eyes? The penance
was as gratifying as, I think, a Catholic’s must be after confession
and absolution given.
Before we were well finished Uncle Jenico came in, a little flurried
and apologetic over his intrusion. He had guessed pretty well the
reason of my detention, and his anxiety would not let him rest. His
hands trembled as he adjusted his spectacles to look at me, and
removed and wiped them, and put them on again for a second
scrutiny.
“So you have conquered?” he said, “My poor boy; my poor, dear
boy! Why I had no idea boxing punished so. You should not have
minded what they said about me, Richard—a tough old rascal, and
ready to take it all in the day’s luck.”
“I don’t think Richard will agree with you, sir,” said Mr. Sant. “He
has won his spurs, and a convert, I hope. He has fought like a
gentleman and a Christian—by George, sir, it was poor Broughton
and the Norwich butcher over again—and you, I am sure, are as
proud of him as I am.”
“Eh?” said my uncle, half laughing and half crying; and then falling
suddenly grave. “If it’s to inculcate respect—the stitch in time, you
know—certainly. But I can’t help wondering, if this is the victor, what
is the state of the vanquished?”
“A state of grace, I hope,” said the clergyman, smiling. “But it’s a
very proper reflection, sir, and one which, I am sure, Richard will take
to heart.”
The reminder, nevertheless, was not out of place. It is well at the
feast of triumph to remember who pays the cost. I had been self-
glorifying a little overmuch; and here, of a sudden, was the picture
before me of my beaten enemy slinking away to hide his battered
face, at the very moment that I was crowing to everybody to come
and look at mine. Uncle Jenico was the true gentleman among us all;
and it was he who had been insulted.
I soon mended of my knocks, and the very next day was ruffling it
to my lessons with a new self-confidence that made nothing of
possessing the world. Dunberry was no longer a Siberia to me, but a
conquered country full of breezy possibilities. I should have
welcomed the prospect of an attack; but no one interfered with me.
On the contrary, awed and covert glances greeted me on my way
past the school. I dropped a book. An obsequious little courtier
scurried to pick it up for me. The news of the fight had got abroad, it
was evident, and Harry was no longer the cock of the walk. From this
moment, with other than the youth of Dunberry, I am afraid, my
position was secured.
I hope I took no base advantage of the knowledge; yet I won’t say
but I might have if Mr. Sant had not been at my back to prevent it.
“Don’t forget you fought for a principle,” he would remind me. “It’s
no manner of Christian use to turn out a bully that you may usurp his
place.”
To prove to me that boxing was not the whole duty of a gentleman,
and to school me from presuming on any idea of indulgence
because of my victory, he rather put the screw on in my education,
and for a time was something of a martinet on questions of study
and discipline. I was hurt, and a little bit rebellious at first; but soon,
having a fair reason of my own, came to recognize his consistency.
During this time, and for some weeks after the fight, I saw next to
nothing of Harry Harrier. He kept out of my way, sulking and grieving,
though he attended school—with phenomenal punctuality, too, I
believe—regularly. His father, I heard from old Jacob, had been very
savage over his beating, and had dressed him well for it. I was
furious when I was told, and wanted Mr. Sant to complain to the
Squire; but, before he could do so, something happened which made
any complaint futile. A new steward, a Draco of a man, was
appointed to the Court, and one day, shortly after his arrival, lo and
behold! there was the gamekeeper handcuffed, and being carried off
to Ipswich gaol in a tax-cart by the officers of the law. It had been
discovered that for years he had been in collusion with a gang of
poachers, and in the end he had been watched, and caught in
flagranti delicto. His wife followed him to the county town, and
devoted most of her savings, poor woman, to his defence, but
without avail. He was convicted and transported, and I may as well
say at once that that was the end of him so far as his family was
concerned, for he never turned up again. While the trial was
pending, Harry—it is not, under all the circumstances, to be
wondered at—gave the schoolhouse a wide berth; but, after his
father had been sentenced and their home broken up, to the surprise
of every one he put in an appearance there again, coming dogged
and punctual to a task which must have grown nothing less than a
perpetual ordeal to him. We did not, in truth, know the strength of will
of the desperate humbled little spirit—not any of us, that is to say,
but Mr. Sant. He had gauged it, I am sure; and, having set his heart
on the boy’s reclamation, was watching with an anxious interest the
development of the odd little drama which he had helped to
engineer. He visited, of course, in virtue of his office, the
gamekeeper’s unhappy wife, who had been forced to betake herself
to a mean little tenement in the village, where she eked out the small
means remaining to her by washing for the rectory; and though, as
yet, the son would hardly notice or be civil to him, the mother did not
fail to acquaint him, with many fond tears, of her poor, wild little
fellow’s real love and resolution, and of the courage which was
determining him to train himself to take the place of the breadwinner
they had lost. All of which, I knew, made Mr. Sant the more eager to
have the lad recognize him for a friend; only pride stood in the way.
For, the truth is, poor Harry’s prestige was gone down to zero.
Always owing in some part to the local reputation of his father for a
bully and rowdy, the removal of that gentleman had finished what my
victory had begun. And now it was the case of the sick lion. The
cowardly little jackals who had formerly cringed to him, egged on by
their more cowardly elders taunted him with his disgrace. If he
retaliated, they overwhelmed him with numbers, or ran, squealing
injured righteousness, to appeal against him to their parents. His
heart, swelling in his plucky little breast, must often have had a
business of it not to let loose the tears; but he had an indomitable
soul, and only time and tact could find the way into it.
One day Mr. Sant and I, when walking together, came unnoticed
upon the rear of such a scene. The victim moved on in front, his
head hanging a little, though he would not force his pace an inch to
accommodate his tormentors, who followed behind, at a safe
distance, hooting and jeering at him.
“OO stole the pawtridges! When did ’ee last ’ear from the ’ulks!
Why don’t ’ee git your mawther to wash your dirty linen, ’ar-ree?” and
such-like insults they bawled.
I burned with indignation, and was running to retaliate on my
enemy by helping him as he had once helped me, when Mr. Sant
seized me with a determined hand, and bent to whisper in my ear—
“He will hate you, if you do. Leave him to fight his own battles.”
As he spoke the little wretches let fly a shower of small missiles,
and a stone struck the boy smartly on the neck. He leapt about at
once, and came rushing back with clenched fists and a blazing face.
The mob dispersed before his onset; but he cut off one panic-
stricken unit of it, and smote the lubberly coward with a thorny crash
into the hedge. His eyes looked red, his breast was heaving stormily;
he would have done some evil, I think, had not Mr. Sant run and put
himself between. Then he backed away, without a word; but his
cheeks were quite white now, and the wings of his nostrils going like
a little winded horse’s.
Consternation held the scattered enemy. They stood each where
he had been halted by the unexpected vision of their rector and me.
The assaulted one, sitting on spikes, stuffed his face into his elbow
and boo-hoo’d from stentorian lungs. Mr. Sant smiled with rather an
ugly look.
“Blubber away, Derrick,” he said. “You’ve been well served for a
dirty act.” Then he scowled abroad. “Are you English boys, to kick a
downed one! Not one of you, cowards, but if he passed this Harrier
alone would hug his fists in his pockets! It is no shame of his, but
yours. To bait him ten to one—O! what fine courageous fellows! But
I’ll have no more of it; d’ye hear? I’ll have no more of it!”
He stamped, in a little access of passion, and again turned sharply
on the fallen.
“Get up!” he said.
His tone was so peremptory that the boy rose, snuffling and wiping
his eyes with his cuff.
“It was you threw the stone,” said Mr. Sant. “I saw you. Very well,
then, it’s got to be one of two things: fight, or put your tail between
your legs and run. Quick now! Which is it to be?”
Derrick did not move, but raised his wail to a pitch so artificially
dismal that I had to laugh.
“Ah!” exclaimed Mr. Sant, still very grim for his part, and snapped
himself round. “He means fight, Harrier.”
If he did, the battle he contemplated was a Battle of the Spurs.
Clapping his hand to the thorns in him, and too frightened now to
remember to cry, he took to his heels and, turning a corner, was out
of sight in a moment. His answer to the resolution claimed for him
was so ludicrous that even his little abettors were set off chuckling.
I was looking across at Harry, and saw his face, too, relax and
lighten. Drawn by its expression, I walked up to him, with my hand
held out.
“Why won’t you, Harry?” I said.
He stared at me, but made no response.
“We knew you could look after yourself,” I went on, “and—and I
wasn’t going to interfere; at least—I mean—why won’t you let us
stand up for one another, Harry?” I ended, with a burst and a blush.
His face, too, was very red again, and I could see his lips were
trembling. Pride and gratitude were fighting within him for mastery;
but the former—still too hot with recent suffering to surrender—
remained the more stubborn of the two. While my hand was yet held
out, he turned his back on me, on us all, and walked off erect.
I was bitterly hurt and chagrined. I felt that I had done the
handsome thing by a boor, and had been meetly rebuffed for my
condescension. I came back to Mr. Sant, swelling with indignation.
He understood at a glance.
“Give him time, Dick,” he said quietly; “give him time.”
“He shall have all the time he likes, sir,” I said, “before I meddle
with him again.”
He did not answer, which was perhaps wise; and we continued our
walk. But thenceforth my heart was darkened to my unchivalrous
foe, and when we passed in the street I ignored him.
My studied indifference had not, however, the effect of making him
avoid me. On the contrary, he seemed rather to resume his earlier
practice, going out of his way to get in mine, and strutting by
whistling to show his unconsciousness of my neighbourhood. Yet all
the time, I knew, he was never more in need of a friend. Mr. Sant’s
protest, followed by a public rebuke in the school, had put an end to
the active bullying; but, to compensate themselves for this
deprivation, his companions had, by tacit agreement, sent poor
Harry to perpetual Coventry. He was disclaimed and excluded from
all games and conversation; isolated in the midst of the others’
merriment. What this meant to the bright fallen little spirit only Lucifer
himself, perhaps, could say; and only Lucifer himself, perhaps, so
endure with unlowered crest while the iron ate into his soul. But, in
justice to myself, I could make no further overtures where my every
advance was wilfully misunderstood.
So the year went its course without any reconciliation between us;
and early in November fell a hard frost, with snow that seemed
disposed to stop. Awaking one morning, we saw the whole land
locked in white under a stiff leaden canopy, as if sea and sky had
changed places. The desolation of this remote coast winter-bound it
is impossible to describe. We seemed as cut off from the world as
Esquimaux; and Uncle Jenico, who had never conceived such a
situation, stood aghast before the prospect of a beach ankle-deep in
snow. So we found it. The golden sand was all replaced by dazzling
silver, into which the surf, so spotless in summer, thrust tongues of a
bilious yellow. The sea, from being sportive with weak stomachs,
looked sick unto death itself; and the wind in one’s teeth was like a
file sharpening a saw. And all this lifelessness cemented itself day by
day, until it seemed that we could never emerge again from the
depths of winter into which we had fallen.
One afternoon I was loitering very dismal, and quite alone as I
thought, near the foot of Dunberry Gap, when a snowball took me full
on the back of the head and knocked my cap off. I was stooping to
pick it up, when another came splosh in my face, blinding, and half
suffocating me. I staggered to my feet, gasping, only to find myself
the butt of a couple of snow forts, between whose fires I had
unconsciously strayed. A row of little heads was sprung up on either
side, and I was being well pounded before I could collect my wits.
I must premise that at this time my empire was much fallen from
its former greatness. Never having confirmed it by a second
achievement, it had gradually lost the best of its credit, and, though I
was still respected by the unit, there was a psychologic point in the
association of units beyond which my reputation was coming to be
held cheap. I was learning, in fact, the universal truth that to rest on
one’s laurels is to resume them, in case of emergency, in a
lamentably squashed condition.
Now, with half the breath knocked out of my body and my arm
protecting my face, I tried to struggle out of the line of fire, only to
find the opposing forces basely combining to pelt me into
helplessness. I made some show of retaliating; but what was one
against twenty? In the midst, I looked up the Gap, my one way of
retreat, and there, standing halfway down, watching the fray, was
Harry Harrier. I was smarting all over, with rills of melted snow
running down my neck, and still the bombardment took me without
mercy.
“Harry!” I cried. “Come and help me!”
The appeal did at a stroke what months of propitiation would have
missed. It put him right with himself once more. Like a young deer he
came leaping down, stooping and gathering ammunition as he
approached. The shower ceased on the instant; the craven enemy
retreated pell-mell to its double lines of shelter.
“Are you ready, sir?” said Harry, excitedly. “Git your wind and coom
on. We’ll drive en out of one o’ them places, and take cover there
ourselves.”
He was eagerly gathering and piling the snow as he spoke. In a
minute I was myself again, and burning for reprisals. Each of us well
armed, we charged upon the left-hand position, which seemed the
more accessible of the two, and carried it by storm against a faint
show of resistance. The garrison shot out and fled, encountering a
volley from the opposing force, while we peppered it in the rear. Our
victory was complete. As we sank back, breathed but glowing, I
looked Harry silently in the face and held out my hand for the last
time. He took it in his own, hanging his silly head; but the nip he
gave it felt like a winch’s.
“That’s all right, then,” said I. “It’s pax between us, ain’t it, you old
fool?”
He nodded. A long silence fell between us, and I began to whistle.
Suddenly he looked up shyly, but his eyes were quick with curiosity.
“I say,” he said, “what’s a parryshoot?”
The problem had evidently haunted him ever since I had told him
that my uncle had fallen from one.
“Well, what do you think?” says I.
“I dunno,” he answered carelessly. “Thought, maybe, ’twas one o’
them things that shoots the malt refuge out of brewhouses.”
I sniggered with laughter. Fancy Uncle Jenico having been shot
out of a brewery!
“It’s an umbrella,” I said; “a thing that you jump into the air with off
a cliff, and come down without hurting yourself.”
“Mighty!” he cried, all excitement. “Is it reelly? Let’s make one—
and try it first on that Derrick,” he added, with commendable
foresight.
My heart crowed at the idea. We discussed it for many minutes. In
the midst we heard a sound of distant jeering, and cautiously raised
our heads above the snow rampart. The whole body of our enemies
was in full retreat, and already nearing the top of the Gap. We were
left alone, sole inseparable masters of the field. It was the happiest
omen of what was to be.
CHAPTER XI.
MISCHIEF OF SORTS.
I came in all glowing to Mr. Sant, who greeted my good news with a
sigh of such relief that one could have thought a nightmare had
rolled off his chest.
“We have him,” he said gleefully. “You did very well, Dick; better
than I could have told you. And now—h’m!”
He fell into a fit of abstraction, the fruits of which did not appear till
the following day. Then, as I was leaving him after lessons, he
detained me a moment.
“Are you going to meet him?” he asked.
“Yes, if he will,” I answered.
“Then,” he said, “tell him that if he likes, and can obtain his
mother’s consent, he can come here with you for the future instead
of going to school.”
I could only breathe a great round “O!” of rapture.
“Yes,” said Mr. Sant, between relish and severity; “I cannot have
so promising a spirit warped by a sense of injustice. He has grit—I
must put my foot down—he—yes, tell him I will undertake his
education, if he is willing.”
I ran off, big with the delight of my mission; and, sure enough, met
Harry loitering near the Playstow by the way I should come, though
he would not let me suppose it was intentional. His freckled face
flushed as he spied me, and he grinned. There was already
observable towards him an attitude of increased respect on the part
of some of his schoolfellows who played near.
“Mighty!” he exclaimed, as I accosted him, “Who’d ever a-thought
o’ meeting you here!”
“Harry!” I whispered, too eager to get him away to feel any
embarrassment. “Come with me. I’ve got something to tell you.”
He came, looking both pleased and curious, but still with a certain
half-defiant swagger.
“Tell away,” he said; “I’m listening;” and he began to whistle.
“Mr. Sant,” I said, “wants you to chuck up the old school and come
and be his pupil with me, if you and your mother’s willing.”
He was fairly hipped. He stopped whistling, and rubbed his round
nose till it shone; then suddenly halted, in a quiet place, and stared
at me.
“Was it you axed him that?” he said.
“No, indeed.”
“Honour bright?”
“Of course. Why should I lie, you old stoopid?”
He tried to whistle again, and broke down. I didn’t know the depths
of the little soul, nor what it had endured.
“I dunno,” he said, hesitating, and with a curious husky sound in
his voice, “as—if it had been—I could a-brought myself to it. Now
——”
He held out his hand quickly, and his eyes were shining.
“Ef you’ll let me be your friend, master, I’ll swear to be yours—till
death do me part—and so help me God!”
We shook hands firmly on it. “Only,” I said, “I’m Dick to you, you
know, just as you are Harry to me.”
“I’ll get used to it in time,” he answered; and so the compact was
made, and I am sure we had none of us reason to regret it.
He was a pretty untamed colt at first, with a little of the savage
lingering about him. But he was wonderfully sensitive and intelligent,
and soon got, under Mr. Sant’s vigorous and manful tuition, not only
to cultivate the graces of a scholar and the muscles of an athlete, but
to understand those right principles of a gentleman, which are to
temper natural combativeness with consideration for others. In this
respect, no doubt, his misfortunes had helped to shape him; but I am
not going to moralise over the result, which I dare say not one boy in
a thousand, coming from such a stock, would have effected. Harry
seemed to have inherited all the hardihood, with none of the brutality,
of his father; and, for the rest, we became inseparable chums, who,
so combined, were a match for any puling forces the village could
bring against us.
Mischief? Of course, we were always in it. One of our first
escapades was to make a parachute out of Uncle Jenico’s big sun
umbrella, and, having beguiled Derrick to the cliff edge by the Gap,
tie his wrists to the handle and push him over. We might have killed
him; only we didn’t. He fell into a snow-drift, with no more hurt than
to rasp his nose on the broken ice. But he smashed the umbrella, for
which Mr. Sant made us pay with extra lines.
We scoured the coast together, and were for ever, forgetting my
embargo, prowling about the Mitre, dislodging bits of the ruin and
imperilling our precious necks. On such occasions Rampick was
always our self-elected policeman, watching us and warning us
away. Singly, I think, we had an awe of this great sinister hulk of a
creature, though, together, we flouted him a good deal, resenting his
interference. But he was a pet of Mr. Sant’s, which made any open
affront from us difficult.
Harry, by virtue of his training, knew a heap about animals. I am
afraid we snared, in our time, more than one of the Squire’s rabbits,
fixing loops of copper wire in the runs under the hedgerows. The
“kill” went to Mrs. Harrier, whose poverty I used for salve to my
conscience, and whose rather weak fondness accepted the tribute
with some nervous deprecation. But it was not long before our
mighty reverence for Mr. Sant, both as a gentleman and a
sportsman, cured us of this temporary obliquity. A poacher gives no
“law” to the game he kills; a gentleman does; we gave no “law”; ergo
we were poachers, ergo we were not gentlemen. The revelation
came upon us one day when our tutor was illustrating some
forgotten parable. “The man of honour,” said he, “the God’s
gentleman, don’t bet on a certainty, or run his fox with a line tied to
his tail, or kill a disarmed enemy, or shoot his pheasant sitting. He
sports for the glory of the battle, the test between skill and skill.”
Harry and I looked at one another, and then down. After lessons
he addressed me rather resentfully—
“It’s all very well for you, as was brought up to it.”
“What do you mean?” I answered; “that you ain’t going to take the
hint?”
“If ever I snare another,” he said, growling, “may I be shot myself
and nailed to a barn door!”
“Well, then,” I said, “for all my being brought up to it, as you call it,
you’re the better gentleman, because I was still in two minds about
giving it up, it was such fun.”
“You’ll have to,” he said. He was grown more loyal even than I to
Mr. Sant.
“O! shall I?” I retorted. “Who’s going to make me?”
We were both bristling for a moment. Then Harry chuckled.
“Guess you won’t catch a-many without me to help you, anyhow,”
he said; which was so disgustingly true that I had to laugh in my turn.
Before this moral reformation occurred, however, we made some
thrilling captures. One day it was a hare, which Harry caught in the
most wonderful way with his hands alone. We were crossing an
open space between two copses, when he suddenly threw down his
hat in the snow, bidding me at the same time to take no notice, but
walk on with him as if unconcerned. There were tufts of gorse and
withered bracken projecting all over the clearing. We advanced
briskly a short distance, then quickly wheeled and came back,
making a crooked line for the hat. As we neared it, Harry, as swift as
thought, swerved aside to a patch of red dead fern and bramble,
and, plunging down his hand, brought up what looked like a mat of
leaves and snow. But it was a hare, which in that unerring swoop he
had clutched behind the poll; and before the startled creature could
shriek or struggle, he had seized its hind legs in his other hand,
stretched its body, and cracked its neck upon his knee. I could not
have imagined such quickness of eye and action. It could only be
done, he told me, in cold weather, when the frost gets in the animals’
brains and makes them stupid. They are sort of fascinated by the hat
thrown down, watching for it to move; and when the steps return,
finding themselves, as it were, between two fires, they can think of
nothing but to crouch close. I have seen Harry bring out rats from a
rick in the same way. It was just a question of unwincing nerve; but I
never had the courage to try it myself. They say that if one has the
resolution to hold one’s hand unmoved to a snapping dog, the
beast’s teeth will close on it without inflicting an injury. It may be true;
only the first time I put it to the test will be in boxing-gloves.
A more legitimate poaching of ours—but that was later, in the
spring—was on the preserves of a beautiful unfamiliar sea-bird,
which came nesting upon our coasts, driven there by storms
probably. We were on the Mitre one day, when we saw it fly out from
the top of the Abbot’s well, and swoop down upon the shore, where,
no one being by, it gorged itself on a heap of dead dog-fish. We
immediately fell flat on the cliff edge to watch for its return. The
broken top of the well was perhaps thirty feet below us, but the
ground sloping obtusely from where we lay, prevented us from
seeing far into it. Presently the bird came back and settled on the
rim, so that we could mark it plainly. It was gull-shaped, but unlike
any of the species we knew—white-waistcoated, yellow-beaked, and
a tender ash colour on the wings—a St. Kilda’s petrel, in fact, we
came to learn, which had likely been driven down from the Orkneys.
It hopped into the well and disappeared.
“Mighty!” said Harry. “It’s got its nest there, I do believe.”
By-and-by the mother bird showed herself, and the fact was
virtually settled. Then there was nothing for it but to climb the well
and see. Harry accomplished it somehow, when the village was at
dinner and the beach deserted. He got up, claw and toe (the well
inclined a little outwards from the land), and availing himself of every
hole and projection reached the top and sprawled over the edge, so
that I could see nothing but his legs waving in the air. The birds shot
out, and wheeled screaming about him. I heard him utter a cry; and
then he emerged and descended with a very blank face, coming
down the last yard or two with a run. His hands were barked and
bloody, and the right one smeared with an orange slime.
“There was one egg,” he said, “white and a whopper; but it just
broke to pieces when I clawed it.”
It was a pity we had not left it alone, for, as it turned out, the bird
was a rarity on our coasts, and, laying as it does only a single egg,
would not likely outstay so cruel a welcome. Which, indeed, proved
to be the case; and the only reward we got for our venture was the
knowledge that the well was choked with sand to near its top, a
discovery which dissipated for ever some long-cherished dreams of
ours as to the ineffable secrets it would reveal if once surmounted
and looked down into.
During all this time, I am afraid, I neglected Uncle Jenico a good
deal. He was so sweet and kind, he made no complaint, but only
rejoiced that I had found a companion more suited than he to my
years.
“He’s a fine boy, Richard,” he would say; “a fine promising boy.
And if he reconciles you to staying here——”
“Do you want to leave Dunberry, uncle?”
Then he would look at me wistfully.
“I, my dear? No, no; I am content, if you are. We are doing
wonderfully well. It’s a place of really extraordinary possibilities. Do
you know, Richard, I shouldn’t be surprised if it turned out to be our
promised land, after all. The extent of coast to be explored makes it
a little tiring sometimes, but that’s a trifle. We can’t expect to find all
Tom Tiddler’s ground in an acre or so, can we?”
That should have been a jog to my conscience; but youth, I fear, is
selfish. A dull day’s hunt with Uncle Jenico through the shingle had
come to show very blank by contrast with the exciting adventures
contrived by Harry and me. So I kept my deaf side to the calls of
duty, and Uncle Jenico pursued his hobby alone.
During the continuance of the frost he had, however, to divert his
imagination into other channels, as the beach was impracticable;
and really, I think, the distraction did him no harm. Being confined
much to the house, he turned his thoughts to an old invention of his
for cleaning chimneys, with which he had competed ages ago for a
prize offered by a syndicate of anti-climbing-boy philanthropists. I am
sure, if simplicity and economy counted for anything, Uncle Jenico
ought easily to have come out first; but it was the usual story of
showiness being preferred to plain utility. The contrivance was
homeliness itself; just a huge compressible ball of wool, attached
through its centre to the middle of a cord of indefinite length; and the
only objection to it—which was, after all, an extremely idle one—was
that it required two operators, one to stand on the roof, and the other
on the hearth below. But, once they were in a position, the task was
a pastime rather than a labour. The top-sawyer, so to speak, lowered
one end of the cord, weighted, down the flue; his companion seized
it, and between them they worked the ball up and down till every
particle of soot was dislodged. Could anything be more obvious?
And yet the committee rejected it! Well, all I can say is that Harry and
I proved its efficacy beyond a doubt; though, of course, Mrs.
Puddephatt, while she benefited by it, was sarcastic about an