100% found this document useful (4 votes)
23 views

Instant Download (Ebook) Pragmatic Python Programming: Learning Python the Smart Way by Gabor Guta ISBN 9781484281512, 1484281519 PDF All Chapters

The document provides information about various Python programming ebooks available for download, including titles like 'Pragmatic Python Programming' by Gabor Guta and 'Learning BeagleBone Python Programming' by Alexander Hiam. It includes links to purchase and download these ebooks in multiple formats such as PDF, ePub, and MOBI. Additionally, it outlines the contents of 'Pragmatic Python Programming,' detailing chapters on expressions, functions, classes, control structures, sequences, and modules.

Uploaded by

riskasuell0c
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
23 views

Instant Download (Ebook) Pragmatic Python Programming: Learning Python the Smart Way by Gabor Guta ISBN 9781484281512, 1484281519 PDF All Chapters

The document provides information about various Python programming ebooks available for download, including titles like 'Pragmatic Python Programming' by Gabor Guta and 'Learning BeagleBone Python Programming' by Alexander Hiam. It includes links to purchase and download these ebooks in multiple formats such as PDF, ePub, and MOBI. Additionally, it outlines the contents of 'Pragmatic Python Programming,' detailing chapters on expressions, functions, classes, control structures, sequences, and modules.

Uploaded by

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

Download the Full Ebook and Access More Features - ebooknice.

com

(Ebook) Pragmatic Python Programming: Learning


Python the Smart Way by Gabor Guta ISBN
9781484281512, 1484281519

https://ebooknice.com/product/pragmatic-python-programming-
learning-python-the-smart-way-44752148

OR CLICK HERE

DOWLOAD EBOOK

Download more ebook instantly today at https://ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Learning BeagleBone Python Programming: Unleash


the potential of BeagleBone using Python by Hiam,
Alexander ISBN 9781784399702, 1784399701
https://ebooknice.com/product/learning-beaglebone-python-programming-
unleash-the-potential-of-beaglebone-using-python-55334008

ebooknice.com

(Ebook) The Coder's Apprentice Learning Programming with


Python 3 by Pieter Spronck

https://ebooknice.com/product/the-coder-s-apprentice-learning-
programming-with-python-3-43242298

ebooknice.com

(Ebook) Learning Scientific Programming with Python by


Christian Hill ISBN 9781107075412, 1107075416

https://ebooknice.com/product/learning-scientific-programming-with-
python-7018158

ebooknice.com

(Ebook) Learning Scientific Programming With Python by


Christian Hill ISBN 9781108745918, 1108745911

https://ebooknice.com/product/learning-scientific-programming-with-
python-12135000

ebooknice.com
(Ebook) Functional Python Programming...Efficient Python
Code by Lott S.

https://ebooknice.com/product/functional-python-programming-efficient-
python-code-56115518

ebooknice.com

(Ebook) Python Machine Learning By Example: The Easiest


Way to Get into Machine Learning by Yuxi (Hayden) Liu ISBN
9781783553112, 1783553111
https://ebooknice.com/product/python-machine-learning-by-example-the-
easiest-way-to-get-into-machine-learning-7371002

ebooknice.com

(Ebook) Learning Scientific Programming with Python by


Christian Hill ISBN 9781108745918, 9781108778039,
1108745911, 1108778038
https://ebooknice.com/product/learning-scientific-programming-with-
python-12198664

ebooknice.com

(Ebook) Learn More Python 3 the Hard Way: The Next Step
for New Python Programmers by Zed A. Shaw

https://ebooknice.com/product/learn-more-python-3-the-hard-way-the-
next-step-for-new-python-programmers-55663952

ebooknice.com

(Ebook) Programming Microcontrollers with Python:


Experience the Power of Embedded Python by Armstrong
Subero ISBN 9781484270585, 1484270584
https://ebooknice.com/product/programming-microcontrollers-with-
python-experience-the-power-of-embedded-python-27573306

ebooknice.com
Pragmatic
Python
Programming
Learning Python the Smart Way

Gabor Guta
Pragmatic Python
Programming
Learning Python the Smart Way

Gabor Guta
Pragmatic Python Programming: Learning Python the Smart Way
Gabor Guta
Budapest, Hungary

ISBN-13 (pbk): 978-1-4842-8151-2 ISBN-13 (electronic): 978-1-4842-8152-9


https://doi.org/10.1007/978-1-4842-8152-9

Copyright © 2022 by Gabor Guta


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.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Celestin Suresh John
Development Editor: James Markham
Coordinating Editor: Mark Powers
Copyeditor: Kim Wimpsett
Cover designed by eStudioCalamar
Cover image by David Clode on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York,
NY 10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.
com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole
member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM
Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for
reprint, paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (https://github.com/Apress/pragmatic-python-programming).
For more detailed information, please visit www.apress.com/source-code.
Printed on acid-free paper
I am thankful to my wife and to my family for their
endurance and support.
Table of Contents
About the Author���������������������������������������������������������������������������������xi

About the Technical Reviewer�����������������������������������������������������������xiii

Acknowledgments������������������������������������������������������������������������������xv

Introduction��������������������������������������������������������������������������������������xvii

Chapter 1: Expression: How to Compute����������������������������������������������1


Expressions with Additional Types������������������������������������������������������������������������3
Boolean Type in an Expression������������������������������������������������������������������������4
String Type in an Expression���������������������������������������������������������������������������4
Expressions with Conditional Operators����������������������������������������������������������5
Floating-Point Number Type in an Expression�������������������������������������������������6
Complex Number Type in an Expression���������������������������������������������������������7
Variable Names�����������������������������������������������������������������������������������������������������8
Statements����������������������������������������������������������������������������������������������������������10
Deletion of a Variable Name��������������������������������������������������������������������������������12
Additional Language Constructs�������������������������������������������������������������������������13
Statements and Expressions in Practice�������������������������������������������������������������14
Advanced Details������������������������������������������������������������������������������������������������16
Names�����������������������������������������������������������������������������������������������������������16
Keywords and Special Names�����������������������������������������������������������������������16
Literals�����������������������������������������������������������������������������������������������������������17
Characters with Special Meaning������������������������������������������������������������������21
Python Standards������������������������������������������������������������������������������������������23

v
Table of Contents

Object Diagram Notation�������������������������������������������������������������������������������23


Key Takeaways����������������������������������������������������������������������������������������������������23

Chapter 2: The Function: Programs as a Series of Statements����������25


Calling a Function�����������������������������������������������������������������������������������������������26
Side Effects of Functions������������������������������������������������������������������������������������27
Function Arguments��������������������������������������������������������������������������������������������29
Defining a Function���������������������������������������������������������������������������������������������30
Keyword Arguments��������������������������������������������������������������������������������������������32
Visibility of Names����������������������������������������������������������������������������������������������33
Functions as Parameters������������������������������������������������������������������������������������35
Definitions of Nested Functions��������������������������������������������������������������������������36
Functions in Practice������������������������������������������������������������������������������������������37
Advanced Details������������������������������������������������������������������������������������������������40
Namespace and Scope����������������������������������������������������������������������������������41
Positional-Only and Keyword-Only Parameters���������������������������������������������41
Variable Number of Arguments���������������������������������������������������������������������42
Lambda Expression���������������������������������������������������������������������������������������43
Decorator�������������������������������������������������������������������������������������������������������43
Yield Statement and Asynchronous Functions����������������������������������������������45
Key Takeaways����������������������������������������������������������������������������������������������������45

Chapter 3: The Class: How to Model the World�����������������������������������47


What Is a Class?��������������������������������������������������������������������������������������������������49
Creating Objects��������������������������������������������������������������������������������������������������50
Using Instance Variables and Methods���������������������������������������������������������������50
Defining Classes�������������������������������������������������������������������������������������������������51
Relationships Among Classes�����������������������������������������������������������������������������55
Properties������������������������������������������������������������������������������������������������������������58

vi
Table of Contents

Inheritance����������������������������������������������������������������������������������������������������������61
Nested Classes���������������������������������������������������������������������������������������������������64
Special Methods�������������������������������������������������������������������������������������������������65
Classes in Practice����������������������������������������������������������������������������������������������68
Advanced Details������������������������������������������������������������������������������������������������70
Class Variables, Class Methods, and Static Methods������������������������������������70
Abstract Base Classes�����������������������������������������������������������������������������������72
Immutable Objects and Data Classes������������������������������������������������������������73
Methods of Identifying Classes���������������������������������������������������������������������76
Class Diagrams����������������������������������������������������������������������������������������������77
Key Takeaways����������������������������������������������������������������������������������������������������78

Chapter 4: The Control Structure: How to Describe the Workflow������81


if Statement��������������������������������������������������������������������������������������������������������82
match Statement������������������������������������������������������������������������������������������������86
while Statement��������������������������������������������������������������������������������������������������90
for Statement������������������������������������������������������������������������������������������������������97
Exception Handling�������������������������������������������������������������������������������������������100
Context Management����������������������������������������������������������������������������������������104
Recursion����������������������������������������������������������������������������������������������������������105
Loops in Practice����������������������������������������������������������������������������������������������106
Advanced Details����������������������������������������������������������������������������������������������108
Matching Classes and Other Kinds of Patterns�������������������������������������������108
Exception Classes����������������������������������������������������������������������������������������111
Context Manager Classes����������������������������������������������������������������������������112
Evaluating Strings���������������������������������������������������������������������������������������113
Activity Diagram������������������������������������������������������������������������������������������113
Key Takeaways��������������������������������������������������������������������������������������������������114

vii
Table of Contents

Chapter 5: The Sequence: From Data to the Data Structure�������������115


Lists and Their Operations��������������������������������������������������������������������������������116
Processing of a List�������������������������������������������������������������������������������������������123
Tuples����������������������������������������������������������������������������������������������������������������127
Dictionaries�������������������������������������������������������������������������������������������������������129
Sets�������������������������������������������������������������������������������������������������������������������132
Copying Sequences�������������������������������������������������������������������������������������������134
Sequences in Practice��������������������������������������������������������������������������������������136
Advanced Details����������������������������������������������������������������������������������������������137
Iterable Objects�������������������������������������������������������������������������������������������137
Deep Copy of Data Structures���������������������������������������������������������������������138
Generator Functions and Coroutines�����������������������������������������������������������139
Functional-Style Manipulation of Lists��������������������������������������������������������143
Multiplicity of Class Diagram Connections��������������������������������������������������143
Sequence Diagram��������������������������������������������������������������������������������������144
Key Takeaways��������������������������������������������������������������������������������������������������145

Chapter 6: The Module: Organization of Program Parts


into a Unit�����������������������������������������������������������������������������������������147
Built-in Modules������������������������������������������������������������������������������������������������148
Defining Modules����������������������������������������������������������������������������������������������152
Packages����������������������������������������������������������������������������������������������������������153
Future Package�������������������������������������������������������������������������������������������������154
Package Management��������������������������������������������������������������������������������������155
Useful Third-Party Packages�����������������������������������������������������������������������������156
Modules in Practice������������������������������������������������������������������������������������������159
Advanced Concepts������������������������������������������������������������������������������������������160

viii
Table of Contents

Structure of Python Projects������������������������������������������������������������������������160


Virtual Environments�����������������������������������������������������������������������������������163
Tools for Testing�������������������������������������������������������������������������������������������163
Tools for Static Analysis�������������������������������������������������������������������������������165
Tools for Formatting������������������������������������������������������������������������������������166
Preparation of Documentation���������������������������������������������������������������������166
Key Takeaways��������������������������������������������������������������������������������������������������169

Appendix A: Binary Representation��������������������������������������������������171

Appendix B: Type Annotations����������������������������������������������������������177

Appendix C: Asynchronous Programming����������������������������������������181

Bibliography�������������������������������������������������������������������������������������189

Index�������������������������������������������������������������������������������������������������193

ix
About the Author
Gabor Guta studied and carried out research
at the Research Institute for Symbolic
Computation, Johannes Kepler University,
Linz, to gain an understanding of the formal
meaning of programming languages. He
worked on complex technology transfer,
cheminformatics, and bioinformatics projects
where both strong theoretical background
and practical software development skills were crucial. Currently, he is
developing distributed software for an open data project. Besides his
software development work, he has been continuously training people
both in academic and industrial settings. He has been actively teaching
Python since 2017.

xi
About the Technical Reviewer
Joshua Willman began using Python in 2015
when he needed to build neural networks
using machine learning libraries for image
classification. While building large image
datasets for his research, he needed to build
a program that would simplify the workload
and labeling process, which introduced him
to PyQt. Since then, he has tried to dive into
everything that is Python.
He currently works as a Python developer, building projects to help
others learn more about coding in Python for game development, AI, and
machine learning. Recently, he set up the site redhuli.io to explore his and
others’ interests in utilizing programming for creativity.
He is the author of Modern PyQt: Create GUI Applications for Project
Management, Computer Vision, and Data Analysis and Beginning PyQt:
A Hands-on Approach to GUI Programming, both published by Apress.

xiii
Acknowledgments
I am thankful to István Juhász, my former diploma supervisor; without his
encouragement and enthusiastic support, this book could not have come
into existence. I am grateful to my friend László Szathmáry, who helped
me as an experienced Python developer and trainer with his insightful
feedback.

xv
Introduction
Communication gaps can build up in IT workplaces between developers
and other roles not requiring programming skills. This gap frequently
hurts the project’s progress and makes cooperation between participants
difficult. My intention is to bridge this gap with this book by explaining the
common mental models with which humans think. I will also demonstrate
the way these models are applied during the programming process.
The book is based on more than two decades of training and software
development experience. Python is not only a popular and modern
programming language, but it is also an easy-to-learn and efficient tool to
reach your goals.
I will not provide too many hands-on exercises and technical details
(how an operating system is built, the way a networking protocol works,
etc.). Regrettably, I cannot offer a quick option to acquire these skills, as
the only way to achieve these skills is with extensive amounts of practice
and troubleshooting. This book will give you a strong basis for starting that
practice.

Structure and Use of the Book


My intention with the book is to discuss the Python language, along the
key concepts, using a new approach. Every chapter of the book starts
with the introduction of a particular concept and then goes through the
advanced features of the language (as if it were a reference manual).

xvii
Introduction

• For those who are just getting acquainted with the


language and whose aim is only to understand the
major concepts of the programming language, focusing
on the first parts of the chapters is recommended.
Please feel free to skip the “Advanced Features”
sections. Studying Appendix A will also be worthwhile.

• For those who are just becoming acquainted with


the language aiming to learn how to program, I
recommend running and experimenting with the
examples. It will be worthwhile to skim the “Advanced
Features” section and then return to that section later
for a detailed reading.

• For experienced software developers, it is worthwhile


to quickly read the first parts of each chapter by paying
attention to the concepts in the Python language that
do not exist in other program languages. For such
readers, the “Advanced Features” sections at the end of
the chapters are mandatory.

Figures use the UML notation, and a short description of their meaning
is shown at the end of Chapters 1, 3, 4, and 5. In the source code examples,
I deviate sometimes from the Python coding standard due to the page
layout constraints. These appear mostly with short or shortened names
and 40- to 50-character lines. Program code examples are conceptually
independent units, but they assume former examples of the book have
been run, since they may refer to definitions in them. The examples are
based on the most up-to-date Python 3.10.2 version available when writing
the book. Most of the examples can be run in versions 3.8.x and 3.9.x,
which are the most widespread at this time. Results of the examples are
intentionally not published in the book. The source code in the book is
available for download and you can experiment with it.

xviii
Introduction

Source Code
All source code used in this book is available for you to download from
https://github.com/Apress/pragmatic-­python-­programming.

Installing an Environment
The installation steps for the most widespread operating systems
(Windows 10, macOS, Ubuntu Linux 22.04 LTS) are described here so you
can run the examples in this book. For another operating system, you can
find assistance on the Internet.

Installation on Windows 10
Follow these steps to install and run Python on Windows 10:

1. Open http://python.org in a browser, select the


Downloads menu, and then select Python 3.10.2 (or
a newer version if it’s offered).

2. The browser automatically launches the download


or displays the file download dialog, which starts the
download.

3. After selecting the Download menu, the newly


downloaded file appears: python-3.10.2.exe.
Launch the installer by clicking the filename.

4. Select the Add Python 3.10 to PATH option in the


installation window and click the “Install now” button.

xix
Introduction

5. The installer continues to inform you about the


status of installation. At the end of the installation,
select the “Disable path length limit” option and
click the Close button.

6. Click the magnifying glass icon next to the Windows


icon, and start typing in cmd. The icon for the
command line appears; open it by pressing Enter.

7. Install and start a Jupyter lab by entering the


python -m pip install jupyterlab and jupyter
lab commands (assuming that the working
directory will be the user directory).

8. After launching the Jupyter lab, the contents of


the working directory will be displayed. If you
download the examples, selecting a file will open
it. Or click the New button and select the Python
3 option; an empty notebook will open in a new
browser window.

9. Your Jupyter notebook is built up from cells. The


content of the cells can be program code, text, or
something else. The default content of the cells is
the Python program code you type in. A cell can be
run by pressing Shift+Enter. The value of the latest
expression will appear under the cell.

xx
Introduction

Installation on macOS
Follow these steps to install and run Python on macOS:

1. Open http://python.org in a browser and select


the Downloads menu. Then select Python 3.10.2 (or
a newer version if it’s offered).

2. The browser automatically launches the download


or displays the file download dialog, which starts the
download.

3. After selecting the Download menu, the newly


downloaded file appears: python-3.10.2-
macosx10.9.pkg. Launch the installer by clicking
this name.

4. Confirm the default settings by clicking the


Continue buttons in consecutive windows in the
browser and then selecting the Install button to
launch the installation.

5. The installer continues to inform you about the


status of installation. At the end of the installation,
click the Close button.

6. Select the Launchpad and start to type in the term


word. The icon for the Terminal appears; click the
icon to open the Terminal.

7. Install and start a Jupyter lab by entering the


python -m pip install jupyterlab and jupyter
lab commands (assuming that the working
directory will be the user directory).

xxi
Introduction

8. After launching the Jupyter lab, the contents of


the working directory will be displayed. If you
downloaded the examples earlier, selecting the
directory will open it. If you click the New button
and select the Python 3 option, an empty notebook
will open in a new browser window.

9. Your Jupyter notebook is built up from cells. The


content of the cells can be program code, text, or
something else. The default content of the cells is
the Python program code you type in. A cell can be
run by pressing Shift+Enter. The value of the latest
expression will appear under the cell.

Installation on Ubuntu Linux 22.04


Python 3.10.x version is installed by default. Follow these steps to run
Python on Ubuntu Linux 22.04:

1. Press the Windows key, and start to type in the word


term. The icon of the terminal appears; open it by
clicking the icon.
2. Install and start a Jupyter lab by entering the
python -m pip install jupyterlab and jupyter
lab commands (by assuming that the working
directory will be the user directory).

3. After launching the Jupyter lab, the contents of the


working directory will be displayed. If the examples
were downloaded earlier, you can open them by
selecting it. If you click the New button and select
the Python 3 option, an empty notebook will open
in a new browser window.

xxii
Introduction

4. Your Jupyter notebook is built up from cells. The


content of the cells can be program code, text, or
something else. The default content of cells is the
Python program code you type in. A cell can be
run by pressing Shift+Enter. The value of the latest
expression will appear under the cell.

After installing a Jupyter lab, you can download the accompanying


Jupyter notebook to its working directory. Now, you are ready to start your
journey in the world of the Python programming language.

xxiii
CHAPTER 1

Expression: How to
Compute
“Expressions are formed from operators and operands.”

Brian W. Kernighan, Dennis M. Ritchie

One of the basic building blocks of programming languages is the


expression, which serves to describe a logical or mathematical relation. In
this chapter, you will learn how exactly an expression denotes relations
between objects, how expressions can be used in statements, and how the
objects can be labeled by names.
As an example, take the calculation of the price of an order. The
formula is as follows: the price of the product multiplied by the quantity
plus the shipping cost. Let’s look at how it is calculated in Python if the
product’s price is 500 USD, two pieces are ordered, and the shipping cost is
200 USD.
Listing 1-1 shows an expression consisting of numbers (integers) and
operators. The order of operations is determined by specific rules (much
like those you can recall from your elementary school education).

Listing 1-1. A Simple Expression

500*2 + 200

© Gabor Guta 2022 1


G. Guta, Pragmatic Python Programming, https://doi.org/10.1007/978-1-4842-8152-9_1
Chapter 1 Expression: How to Compute

Caution Spaces should not be inserted before the expressions and


statements shown in this chapter, and they should not be broken
into multiple lines. This is important as the space(s), tabulators at the
beginning of the lines, and line breaks do have a special meaning in
Python. The relevant rules are detailed later in the chapter.

The computer processes the expression in Listing 1-1 in multiple


steps. Integers are considered objects, which, in this case, are integer
type ones. The structure referred to as the expression tree and shown in
Figure 1-1a is constructed of integer objects and operators. In the figure
the rectangles are objects or operators; if the objects correspond to an
operator, they are linked with lines to the operator. You can find a bit
more about this standard notion at the end of the chapter. The expression
tree is constructed by assigning objects to an operator, among which the
operation is to be performed. In the expression tree, the result of another
operator can also be assigned to an operator, not just an object. This is
indicated by connecting it to another operator, meaning that it is to be
performed first, and the resulting object will be used then. The uppermost
element of the expression tree is the operator to be performed last.
The computer interprets the expression tree by performing the
operators between objects first. In the example, this is the leftmost
multiplicative operator at the bottom. The result of this operator will be a
new integer object with the value of 1000. Figure 1-1b shows the resulting
intermediate expression tree, along with the addition operator between
the integer objects with the values 1000 and 200, and the result is an
integer object value 1200, as shown in Figure 1-1c.

2
Chapter 1 Expression: How to Compute

+:operator +:operator 1200:int

*:operator 200:int 1000:int 200:int

500:int 2:int

a) Original Expression b) After Multiplication c) Final Result

Figures 1-1a, 1-1b, and 1-1c. Simple expression

If there is uncertainty about the operation order, placing brackets is


encouraged, as in Listing 1-2.

Listing 1-2. Fully Parenthesized Expression

((500*2) + 200)

The expression without brackets and the fully bracketed expression


have the same meaning for the computer. Notably, the expressions can be
of any complexity; however, there is a certain level of complexity where
they become difficult to understand.

Expressions with Additional Types


In Listing 1-1, we have seen integers as objects on which to perform the
operators. Expressions, however, can be used in the general sense, whereas
operators can be performed between objects of various types. In addition
to the integer type objects, other types of objects will also be covered, e.g.,
Boolean types (true/false values) and strings. You will learn how to create
your own type in Chapter 3.

3
Chapter 1 Expression: How to Compute

The type of the particular object is important also because certain


operators can be executed only by objects of a specified type. If, for
example, an attempt was made to add an integer and a string, an error
will be raised. When the operation has been successfully executed, the
resulting object will always have a type (determined by the operation,
the object performing the operation, and the type of the other object
participating in the operation).

Boolean Type in an Expression


Listing 1-3 shows an expression where two integers are compared. When
comparing two integers, the created new value will be of the Boolean
type. The true value is denoted by the word True, while the false value is
represented by False. Part of this expression tree on the left side of the
comparison sign is the same as the previous example, and its evaluation
is also the same. Thus, the last step will be carrying out the comparison,
wherein the result of comparing the two integers will be a True object.

Listing 1-3. Boolean Expression

500*2 + 200 >= 1000

String Type in an Expression


Listing 1-4 contains string objects. The string type objects are characters
between single or double quotation marks. From these quotation marks,
the computer will know where characters forming the string begin
and where they end and that there is no need to interpret them, just to
handle them as any text. The addition operator between strings means
concatenation. The first step upon evaluation of this expression is the
formation of a novel string object from the two left string objects, and then
in the next step, the resulting string object is created by the concatenation
of the newly created string object and the right-side object.

4
Chapter 1 Expression: How to Compute

Listing 1-4. Operation Between Strings

'no' + ' ' + 'discount'

Expressions with Conditional Operators


A conditional expression can describe the computation that the result
should be one or another value depending on some condition. This
expression is interpreted among three objects. The first object is of any
type, the supposed value when the condition is fulfilled. The second object
is of Boolean type, the condition itself, after the word if. The last object
is the expected value when the condition is not fulfilled, located after the
word else. (As you would expect, any of the objects can be substituted
with an expression.) Listing 1-5 demonstrates how to combine the
conditional expression with the types reviewed so far.

Listing 1-5. Conditional Expression

'5%' if 500*2+200 >= 1000 else 'none'

The task solved by the example is the following: if the amount of the
order is greater than 1000, a string containing the discount rate would be
created with the values 5% or none. Figure 1-2 shows the expression trees
formed upon evaluation of the expression.

5
Chapter 1 Expression: How to Compute

if-else:operator if-else:operator

'5%':str >=:operator 'none':str '5%':str >=:operator 'none':str

+:operator 1000:int +:operator 1000:int

*:operator 200:int 1000:int 200:int

500:int 2:int

a) Original Expression b) After Multiplication

if-else:operator if-else:operator '5%':str

'5%':str >=:operator 'none':str '5%':str True:bool 'none':str

1200:int 1000:int

c) After Addition d) After Comparison e) Final Result

Figures 1-2a, 1-2b, 1-2c, 1-2d, and 1-2e. Expression with


multiple types

Floating-Point Number Type in an Expression


Finally, let’s look at the number types. Three kinds of number types are
distinguished in Python: integers, floating, and complex numbers. You have
already seen examples for the integers. The float type can store the decimal
6
Chapter 1 Expression: How to Compute

fractions. Listing 1-6 shows an expression wherein two decimal fractions


with the same value are added (the first number object was written in the
usual format as 0.05, while the other one was in 5*10-2 format).

Listing 1-6. Floating-Point Numbers

0.05 == 5e-2

Complex Number Type in an Expression


Complex numbers (used in higher mathematical computations) are
called the complex type. The simplest way a complex number could be
considered is a pair of decimal fractions wherein the first one is the real
value, and the second one is the imaginary one. The imaginary value
corresponds to the square root of -1. It is checked in Listing 1-7, if (0+1j)2 is
really equal to the value of -1.

Listing 1-7. Complex Numbers

(0+1j)**2 == -1

During the design of the Python language, it was a vital design decision
that it should contain a small number of built-in types, and at first sight,
the behavior of those types is the same as that of the other, not built-in
types. Only five data types are examined more thoroughly here; the rest
will be discussed in Chapters 5 and 6.

Tip In the Python language, it is possible to put the comparisons


into a chain, meaning the 0 < a and a < 100 expressions can
be written in the form of 0 < a < 100. The two expressions are
equivalent, except that in the second case the expression standing in
the place of a is computed only once. This notation can also be used
between more than two comparisons.

7
Chapter 1 Expression: How to Compute

Variable Names
Now that we have seen how to carry out computation in specific cases,
let’s look at how a computation can be generalized. For this case, objects
are assigned to variable names. Variable names may be thought of most
simply as labels. Variable names usually begin with a letter and continue
with letters or digits. The expression in Listing 1-5 could be rewritten by
first assigning the numbers to variable names, as shown in Listing 1-8.
The advantage of this approach is that in case we were to compute the
expression for other numbers, we simply change only the assignment
statements in lines 1–3 and would not have to modify the expressions.

Listing 1-8. Assignment Statements

PRICE = 500
QUANTITY = 2
LIMIT = 1000
total_amount = PRICE * QUANTITY
d_available = total_amount >= LIMIT
discount = '5%' if d_available else 'none'

To express the intent that the variable names to which the value once
assigned will not require change, the variable names are capitalized. This
notation is not more than a convention, and the Python language does not
prevent them from being changed.
The resulting expression is thus much easier to understand.
Importantly, not the formula itself is assigned to the variable name, but
an object created upon computation of the expression instead. It is always
necessary to assign an object to the variable name before it is used (it
must appear on the left side of the equation before it can appear on the
right side).

8
Chapter 1 Expression: How to Compute

Variable names are also used to break down complicated expressions


into simpler ones. This can be accomplished by assigning some part of
the expression to the variable names and then using the variable names
in place of the extracted expressions. Furthermore, if the variable names
assigned to the particular expressions are chosen well, the meaning of the
expression will be more explicit.

Tip When do you have to insert space between characters? The


short answer is: when the characters without space would evidently
have a different meaning. For example, the meanings of a + b and
a+b are the same; thus, the space can be left out. But the cases of
a b and ab are different; the two names (identifiers) would become a
single name. Table 1-1 shows some examples. If spaces do not affect
the meaning, they can be inserted or omitted, depending on readability.
The detailed answer will be given in the section “Advanced Details.”

Table 1-1. Effects of Spaces Between Characters


Without Space With Space Interpretation

a+b a + b Identical.
a=2 a = 2 Identical.
ab a b Adding a space between alphabetic characters turns
the single name into two separate names, which are
in most cases syntactically incorrect (an important
exception is when one of the names is a keyword).
12 1 2 Adding a space between numeric characters turns
a single literal into two separate literals, which are
in most cases syntactically incorrect.
(continued)

9
Chapter 1 Expression: How to Compute

Table 1-1. (continued)

Without Space With Space Interpretation

a1 a 1 Adding a space between an alphabetic and a


numeric characters turns the single name into
a name and a literal, which are in most cases
syntactically incorrect (an important exception is
when the name is a keyword).
1a 1 a Adding a space between a numeric and an
alphabetic characters turns the syntactically
incorrect character sequence into a literal and a
name, which are in most cases also syntactically
incorrect (an important exception is when
the name is a keyword like 1 or); in earlier
versions of Python 1or character sequence was
syntactically correct, but know it is deprecated
and will cause a syntax error in the future.

S
 tatements
Listing 1-8 showed a program consisting of multiple lines. Each line is one
statement, more precisely an assignment statement. Programs consist of
statements that are executed one after the other, thereby exerting some effect
on their environment. The default in Python is that one line is one statement.
The recommended maximal line length is 79 characters. Listing 1-9 shows
how a long statement can be stretched to multiple lines (lines 3 to 7) or
multiple statements can be condensed into a single line (line 7). When a line
is too short for a statement, part of the statement can be brought over to the
following line after an end-of-line backslash (\). Should we want to compact
multiple statements in a line, the statements would have to be separated by a
semicolon (;). Both notations should generally be avoided.

10
Chapter 1 Expression: How to Compute

Listing 1-9. Statements

PRICE = 500
QUANTITY = 2
PRICE = \
500
QUANTITY = \
2
PRICE = 500; QUANTITY = 2

Integer objects are assigned to variable names in the previous example.


If, for example, statements in the second and third lines were replaced, an
error would occur since there are no objects yet assigned to the quantity
label. It is also a consequence of the stepwise statement execution that no
object assigned to a variable name would change (except for the unit price)
if one more PRICE = 450 line were inserted at the end of the program. For
example, the d_available variable name would still point to an object
with a true value. To change the assignments, the statements from line 3 to
line 5 would have to be re-executed.
The assignment statement consists of a name, an assignment operator,
and an expression. In Python, the equal sign means the result of the right-
side expression is assigned to the left-side variable name. (The double
equal sign is used to test the equality of two expressions.) The assignment
statement is not an expression; therefore, it does not have a return value.
To obtain an object assigned to the variable name as an expression, the
:= walrus operator can be used, but it can be used only in restricted cases
(details of the walrus operator will be explained in Chapter 5).

11
Chapter 1 Expression: How to Compute

Deletion of a Variable Name


Variable names can also be deleted by the del statement. In Listing 1-10,
after the variable name difference is deleted, reading the variable name
content results in an error. Objects assigned to the variable names
are automatically unallocated when they are not referenced anymore
(i.e., when they are not assigned to any variable names). Referencing
to the variable name difference after Listing 1-10 would cause a
NameError error.

Listing 1-10. Deletion of a Variable Name

difference = 550 - 500


del difference

Note The source code elements are the expressions, statements,


and concepts touched upon later. The name source code (a code
readable for humans) originates from the fact that it is the source of
the executable code run by the computer. Files containing the source
code are referred to as source files. We can speak about a program
when we want to emphasize that it is about the source code realizing
an independent and meaningful task. For completeness, programs
that can be run as direct source code are usually called scripts.
Unfortunately, these denominations are often used loosely in the
literature and leave the correct interpretation to the reader.

12
Chapter 1 Expression: How to Compute

Additional Language Constructs


In the program fragments described so far, objects are expressed by
specific integer, string, and Boolean (True and False) values. Their
collective term is literals. Operators are used between them. You have seen
the if and else names in the conditional expressions. Names with such
special meaning are called keywords. The pass keyword represents the no
operation statement. This statement is used to designate that a statement
would follow, but our deliberate intention is that nothing happens at that
point of the program.
The text located after the character # up to the end of the line is called
a comment that is used to place any textual information. A comment is a
message to the reader of the source code and can help in understanding
the program. If variable names in the program are chosen well, a minimum
amount of commenting is necessary.
Multiline comments can be achieved with multiline strings. Multiline
strings start and end with a triple quotation mark (typically """), and line
breaks are allowed inside the string. Technically these are not comments,
but expressions. So, multiline comments must always start in a separate
new line. You will see in Chapter 2 that these multiline comments can have
a special role depending on their position in the source code. Listing 1-11
shows some examples.

Listing 1-11. Pass Statement and Comments

pass #this statement does nothing


# this line is only a comment
""" these lines form
a multiline
comment """

13
Chapter 1 Expression: How to Compute

Statements and Expressions in Practice


With type annotations, the expected type of object to be assigned to the
variable name can be expressed. Python is a dynamically typed language,
which means that the type of a variable name depends solely on the type of
the assigned object. This means that currently Python does not check if these
type annotations are correct. Originally, Python did not have any notation to
explicitly add typing information as it was considered extra effort to maintain
and makes the code more inflexible. As Python is used for large and complex
programs, these annotations become more useful for the developers and
tools. External tools can be used to verify whether the assigned object types
are consistent with the type annotations without running the program. Use
of external tools will be described in Chapter 6. The type is specified after the
variable name, separated from it by a colon, as shown in the Listing 1-12.

Listing 1-12. Assignments with Type Definitions

PRICE: int = 500


QUANTITY: int = 2
LIMIT: int = 1000
total_amount: int = PRICE * QUANTITY
d_available: bool = total amount >= LIMIT
discount: str = '5%' if d_available else 'none'

It is crucial for the readability of the program to put spaces in certain


spots in the expressions and statements. The documentation of Python
contains a recommendation for the placement of spaces to ensure the best
readability:

• It is recommended to insert a space on both sides of an


equal signs; and put a space only after colons.
• Extra spaces should not be inserted for parentheses,
but spaces are recommended so that the context is
preserved.

14
Chapter 1 Expression: How to Compute

• Spaces are inserted around the operators as a default;


an exception is if the order of operations in the
expression is other than simply from left to right, since
there are parentheses, or certain operations should
be executed sooner. In this case, spaces are removed
around operations executed sooner, such as in the case
of (a+2) * (b+4) or a*2 + b*4.

If required, the aim or use of the statements can be documented by


a comment placed after it (beginning with the character #, as discussed
earlier). Lengthier comments can be placed among the statement lines,
and each line should begin with the character #. It is recommended that
the information recorded here should be such that it could not be figured
out from the variable names and the type annotations.

Tip An expression can be included in the so-called formatted string


literals (or f-strings). In this case, there is a letter f (as shown in Listing 1-13)
before the string’s opening quotation mark, and the expressions are
within the quotation marks, between the braces. The result of these
expressions will be inserted after they are converted to a string.
In the f-strings, format specifiers can also be added after the
expression, separated by a colon (:). Listing 1-14 shows the format
of the variable PRICE1 as a decimal fraction with two decimal places
and shows writing out variable PRICE2 as an integer filled with 0s,
up to five digits.

Listing 1-13. Formatted String Literals

PRICE1 = 10
PRICE2 = 2500
Difference of f’{PRICE1} and {PRICE2} is {PRICE2-PRICE1}'

15
Chapter 1 Expression: How to Compute

Listing 1-14. Formatted String Literals with Format Specifiers

f'{PRICE1:.2f}, {PRICE2:05d}'

Advanced Details
This section describes technical details in reference manual style and
advanced concepts that may need more technical background.

Names
You saw that names (also called identifiers) can be given to objects. The
following characters can be present in a name: beginning with a letter or
an underscore and continuing with a letter-like character, underscore,
or digit. Letter-like means that other categories are added to characters
considered letters in the Unicode standard, namely, the “nonspacing
mark,” the “spacing combining mark,” and the “connector punctuation”
categories. Within names Python discriminates lowercase and uppercase
letters, but certain character combinations can be regarded the same
according to the NFKC standard. It is recommended to use only letters of
the English alphabet in names.

Keywords and Special Names


There are certain names that have special meaning in Python; these are
called keywords and are shown in Table 1-2. You have already learned the
meanings of the keywords True and False, and the meanings of the other
ones will be gradually introduced in subsequent chapters.

16
Chapter 1 Expression: How to Compute

Table 1-2. Keywords

and as assert async await


break class continue def del
elif else except False finally
for from global if import
in is lambda None nonlocal
not or pass raise return
True try while with yield

Names both beginning and ending with a double underscore character


may have a special meaning in the Python language. Therefore, your own
variables should not be denoted in this way. A single or double underscore
only at the beginning of the name is not subject to this restriction. Their
function is detailed in Chapter 3. A single underscore after a variable name
is used in case the name would otherwise be a keyword. Finally, a single
underscore character as a variable name is used to signal that the value
of the variable won’t be used, but defining a variable name is required for
syntactic constraints.

Literals
Literals represent objects corresponding to their meanings. Rules applied
to the bool, complex, float, int, and str type values are as follows:

• The value of a Boolean can be true or false. The true


value is denominated by True, while false is signified
by False.

17
Chapter 1 Expression: How to Compute

• There are also rules applied for integers. Simple


decimal integers begin with a digit that is not zero and
continue with any digit. If a zero is written, any integer
of zeros can follow, but no other digits. If an integer is
written in a system other than decimal, the b, o, or x
letters after a zero digit annotate the following number
in the binary, octal, or hexadecimal number system;
then the particular number itself is written according
to the rules of the particular number system. (For
example, in terms of the binary number system, digits
can be only 0 or 1, while in the case of the hexadecimal
system, besides the number 9, the lowercase or
uppercase letters between A and F are allowed.
Lowercase or uppercase letters are both allowed for
the letters denoting the number system, as they are for
the numbers in the hexadecimal system.) Numbers
can always be separated by underscoring. Listing 1-15
shows examples of the previously mentioned syntax.

Listing 1-15. Integers in Various Number Systems


42
0b10_1010
0o52
0x2A

• Floats or, more precisely, floating-point numbers, are


those always represented in the decimal system: a dot
is placed within the integer or around it, or the integer
exponent of number 10 multiplying the particular
number is written after the number, separated by a
letter e. Floating-point numbers used in Python are
according to the IEEE 754 standard.

18
Chapter 1 Expression: How to Compute

• Complex numbers, in turn, can be represented by two


floats. One of them is the imaginary part that is denoted
by a letter j written after a float; according to this
notation, the 1j corresponds to the square root of -1.

• Strings are written between pairs of quotation marks, '


or ". The meanings of the two kinds of quotation marks
are the same, but it is recommended to select one and
use that one consistently. An exception is when the
original text itself contains a kind of quotation mark.
In this case, it is recommended to use the other kind at
both ends of the string. If you want to write a multiline
string, it will have to be between the characters of '''
or """. Any character except the quotation mark can
appear within a string. If you would like to write the
same characters as the opening and closing quotation
marks, we have to use a backslash character before
them. After the backslash, other characters can denote
otherwise not representable characters (according to
Table 1-3).

19
Chapter 1 Expression: How to Compute

Table 1-3. Escape Character Table


Character Meaning

\ and “new line” The backslash and the new line will be ignored.
\\ The backslash itself (\).
\a ASCII bell character (BEL).
\b ASCII backspace (BS).
\f ASCII form feed (FF).
\n ASCII linefeed (LF).
\r ASCII carriage return (CR).
\t ASCII horizontal tabulation (TAB).
\v ASCII vertical tabulation (VT).
\ooo Character code with a value of ooo in an octal number system.
\xhh Character code with a value of hh in a hexadecimal number system.

• The character r can be present before strings with the


effect of the backslash character working as a simple
character. This is useful in describing access paths (for
example, the r 'C:\Users' notation is equivalent to
'C:\\Users') and regular expressions. The letter f
can also be present before strings, meaning that if an
expression is written between the characters { and }, it
is computed, and the result will be inserted as a string
(see the former paragraph on formatted string literals).
The letter b may also occur; you can find a more
detailed description about it in Appendix B.

20
Chapter 1 Expression: How to Compute

Characters with Special Meaning


Table 1-4 summarizes characters having a special meaning in Python.
Operations are denoted in the expressions by the operator characters.
Delimiters occur primarily in statements. Other special characters serve to
denote values or comments. There are characters that can be used only in
literals.

Table 1-4. Characters with Special Meaning


Category Characters

Operators << >> & ^ ~ :=


< > <= >= == !=
Delimiters , : . ; @ = ->
+= -= *= /= //= %= @=
&= |= ^= <<= >>= **=
Other special characters ’ " # \
Can be used only in strings $ ? ‘

The dot can appear within a decimal fraction. Three consecutive dots
may be present one after the other, which is called an ellipsis literal. This is
not used in core Python, only in some extensions (e.g., NumPy).
Table 1-5 shows that the precedence of the operators is shown
downward increasing. Stronger operations will be performed first.
If strengths were equal, applying the operations takes place from left
to right. An exception is exponentiation with a reverse direction of
application.

21
Chapter 1 Expression: How to Compute

Table 1-5. Precedence of Operators


Operators Meaning

x := y Assignment expression
x if y else z Conditional expression
x or y Logical or
x and y Logical and
not x Logical negation
x in y, x not in y, Membership tests,
x is y, x is not y, identity tests,
x < y, x <= y, x > y, and comparisons
x >= y, x != y, x == y
x | y Bitwise or
x ^ y Bitwise exclusive or
x & y Bitwise and
x << y, x >> y Bitwise shift
x + y, x - y Addition, subtraction
x / y, x // y, x % y Division, integer division,
remainder
+x, -x, ~x Positive, negative, bitwise negation
x**y Raising to the power
(x) Expression in parentheses

22
Chapter 1 Expression: How to Compute

Python Standards
The Python language is defined in The Python Language Reference. The
content of the book covers basically this document. In addition, several
language-related standards will be described in the Python Enhancement
Proposals; they are usually referenced as PEP plus a number. An often
mentioned PEP document is PEP 8, which contains a recommendation for
formatting the Python source code.

Object Diagram Notation


Figures used in the chapter are represented in the object diagram notation
of the Unified Modeling Language (UML). These diagrams can represent
objects and their connections of a particular moment. Rectangles
represent objects in the diagrams. The names of the objects appear as text
written into the rectangle. The names of the objects are always written
underlined, optionally with its type after it preceded by a colon. Lines
between the rectangles denote connections. Objects in the figures are
denoted according to their value, and the value is not represented by a
separate instance variable.

Key Takeaways
• In the chapter, you learned about the concept of an
expression, which is one of the most important building
blocks of programming languages. An expression
describes operations between objects. Usually, the goal
of their usage is to construct a new object needed for
the next step of processing (e.g., calculating the sum of
the price of products).

23
Chapter 1 Expression: How to Compute

• The statements describe a step of a program and make


changes in the execution context. The assignment
statement, which assigns an object to a name, is a good
example of this. An expression can serve as a statement,
but statements cannot stand where expressions are
expected.

• The variable name is the first tool to organize your


program. For example, a complex expression can
be broken into several simpler expressions of which
results are assigned to variable names and then
combined in a final step.

24
CHAPTER 2

The Function:
Programs as a Series
of Statements
“It is usual in mathematics—outside of mathematical logic—to use the
word function imprecisely and to apply it to forms such as y2 + x. Because
we shall later compute with expressions for functions, we need a distinction
between functions and forms and a notation for expressing this distinction.
This distinction and a notation for describing it, from which we deviate
trivially is given by Church.”

John McCarthy et al.

The function is the simplest construct able to describe a behavior.


Functions can behave similarly as in math: they compute a number from
a given number or numbers. Functions in programming languages are
of a somewhat more general construction, though: they generate a new
object by executing statements from given objects. In this chapter, you will
learn how functions work in programming languages and about related
concepts such as blocks.

© Gabor Guta 2022 25


G. Guta, Pragmatic Python Programming, https://doi.org/10.1007/978-1-4842-8152-9_2
Chapter 2 The Function: Programs as a Series of Statements

C
 alling a Function
Let’s start by looking at how to use the built-in functions that already exist
in Python. Using a function usually means executing a function call. The
result of the function is referred to as the returned value. The computer
executes the statements assigned to the function name with the specified
objects, and the result object will be obtained. This is expressed by
placing a pair of parentheses after the function name, in which parameter
objects are enumerated optionally. The enumerated objects are called the
arguments of the functions. Calling the absolute value function visible in
Listing 2-1 will result in a number object with a value of 1. This is exactly
what you would expect from the |-1| expression.

Listing 2-1. Calculation of an Absolute Value

abs(-1)

The function call can be combined with expression notations: it can


be present anywhere a reference to an object can be written, and so the
arguments of the function can become arbitrarily complicated expressions.
From among the built-in mathematical functions you saw examples for the
absolute value function (abs()). In addition, there also exists the functions
of raising to a power (pow()) and rounding (round()). You can see this in
Listing 2-2. The result of price calculation of 3499 with tax (which is 10%
in the United States, so the original number must be multiplied by 1.1) is
3848.9, which is rounded to an integer (to 3849) in the example.

Listing 2-2. Calculation of a Rounded Value

round(3499 * 1.1)

26
Discovering Diverse Content Through
Random Scribd Documents
6
The Gentle Art of Blackmail
It was exactly five minutes to four when Virginia Revel, rendered
punctual by a healthy curiosity, returned to the house in Pont Street.
She opened the door with her latchkey, and stepped into the hall to
be immediately confronted by the impassive Chilvers.
“I beg pardon, ma’am, but a—a person has called to see you——”
For the moment, Virginia did not pay attention to the subtle
phraseology whereby Chilvers cloaked his meaning.
“Mr. Lomax? Where is he? In the drawing-room?”
“Oh, no, ma’am, not Mr. Lomax.” Chilvers’ tone was faintly
reproachful. “A person—I was reluctant to let him in, but he said his
business was most important—connected with the late Captain, I
understood him to say. Thinking therefore that you might wish to
see him, I put him—er—in the study.”
Virginia stood thinking for a minute. She had been a widow now for
some years, and the fact that she rarely spoke of her husband was
taken by some to indicate that below her careless demeanour was a
still aching wound. By others it was taken to mean the exact
opposite, that Virginia had never really cared for Tim Revel, and that
she found it insincere to profess a grief she did not feel.
“I should have mentioned, ma’am,” continued Chilvers, “that the
man appears to be some kind of foreigner.”
Virginia’s interest heightened a little. Her husband had been in the
Diplomatic Service, and they had been together in Herzoslovakia just
before the sensational murder of the King and Queen. This man
might probably be a Herzoslovakian, some old servant who had
fallen on evil days.
“You did quite right, Chilvers,” she said with a quick, approving nod.
“Where did you say you had put him? In the study?”
She crossed the hall with her light buoyant step, and opened the
door of the small room that flanked the dining-room.
The visitor was sitting in a chair by the fireplace. He rose on her
entrance and stood looking at her. Virginia had an excellent memory
for faces, and she was at once quite sure that she had never seen
the man before. He was tall and dark, supple in figure, and quite
unmistakably a foreigner; but she did not think he was of Slavonic
origin. She put him down as Italian or possibly Spanish.
“You wished to see me?” she asked. “I am Mrs. Revel.”
The man did not answer for a minute or two. He was looking her
slowly over, as though appraising her narrowly. There was a veiled
insolence in his manner which she was quick to feel.
“Will you please state your business?” she said, with a touch of
impatience.
“You are Mrs. Revel? Mrs. Timothy Revel?”
“Yes. I told you so just now.”
“Quite so. It is a good thing that you consented to see me, Mrs.
Revel. Otherwise, as I told your butler, I should have been compelled
to do business with your husband.”
Virginia looked at him in astonishment, but some impulse quelled the
retort that sprang to her lips. She contented herself by remarking
dryly:
“You might have found some difficulty in doing that.”
“I think not. I am very persistent. But I will come to the point.
Perhaps you recognize this?”
He flourished something in his hand. Virginia looked at it without
much interest.
“Can you tell me what it is, madame?”
“It appears to be a letter,” replied Virginia, who was by now
convinced that she had to do with a man who was mentally
unhinged.
“And perhaps you note to whom it is addressed,” said the man
significantly, holding it out to her.
“I can read,” Virginia informed him pleasantly. “It is addressed to a
Captain O’Neill at Rue de Quenelles No. 15, Paris.”
The man seemed searching her face hungrily for something he did
not find.
“Will you read it, please?”
Virginia took the envelope from him, drew out the enclosure and
glanced at it; but almost immediately she stiffened and held it out to
him again.
“This is a private letter—certainly not meant for my eyes.”
The man laughed sardonically.
“I congratulate you, Mrs. Revel, on your admirable acting. You play
your part to perfection. Nevertheless, I think that you will hardly be
able to deny the signature!”
“The signature?”
Virginia turned the letter over—and was struck dumb with
astonishment. The signature, written in a delicate slanting hand, was
Virginia Revel. Checking the exclamation of astonishment that rose
to her lips, she turned again to the beginning of the letter and
deliberately read the whole thing through. Then she stood a minute
lost in thought. The nature of the letter made it clear enough what
was in prospect.
“Well, madame?” said the man. “That is your name, is it not?”
“Oh, yes,” said Virginia. “It’s my name.” “But not my handwriting,”
she might have added.
Instead she turned a dazzling smile upon her visitor.
“Supposing,” she said sweetly, “we sit down and talk it over?”
He was puzzled. Not so had he expected her to behave. His instinct
told him that she was not afraid of him.
“First of all, I should like to know how you found me out?”
“That was easy.”
He took from his pocket a page torn from an illustrated paper, and
handed it to her. Anthony Cade would have recognized it.
She gave it back to him with a thoughtful little frown.
“I see,” she said. “It was very easy.”
“Of course you understand, Mrs. Revel, that that is not the only
letter. There are others.”
“Dear me,” said Virginia, “I seem to have been frightfully indiscreet.”
Again she could see that her light tone puzzled him. She was by now
thoroughly enjoying herself.
“At any rate,” she said, smiling sweetly at him, “it’s very kind of you
to call and give them back to me.”
There was a pause as he cleared his throat.
“I am a poor man, Mrs. Revel,” he said at last, with a good deal of
significance in his manner.
“As such you will doubtless find it easier to enter the Kingdom of
Heaven, or so I have always heard.”
“I cannot afford to let you have these letters for nothing.”
“I think you are under a misapprehension. Those letters are the
property of the person who wrote them.”
“That may be the law, madame, but in this country you have a
saying ‘Possession is nine points of the law.’ And, in any case, are
you prepared to invoke the aid of the law?”
“The law is a severe one for blackmailers,” Virginia reminded him.
“Come, Mrs. Revel, I am not quite a fool. I have read these letters—
the letters of a woman to her lover, one and all breathing dread of
discovery by her husband. Do you want me to take them to your
husband?”
“You have overlooked one possibility. Those letters were written
some years ago. Supposing that since then—I have become a
widow.”
He shook his head with confidence.
“In that case—if you had nothing to fear—you would not be sitting
here making terms with me.”
Virginia smiled.
“What is your price?” she asked in a business-like manner.
“For one thousand pounds I will hand the whole packet over to you.
It is very little that I am asking there; but, you see, I do not like the
business.”
“I shouldn’t dream of paying you a thousand pounds,” said Virginia
with decision.
“Madame, I never bargain. A thousand pounds, and I will place the
letters in your hands.”
Virginia reflected.
“You must give me a little time to think it over. It will not be easy for
me to get such a sum together.”
“A few pounds on account perhaps—say fifty—and I will call again.”
Virginia looked up at the clock. It was five minutes past four, and she
fancied that she had heard the bell.
“Very well,” she said hurriedly. “Come back to-morrow, but later than
this. About six.”
She crossed over to a desk that stood against the wall, unlocked one
of the drawers, and took out an untidy handful of notes.
“There is about forty pounds here. That will have to do for you.”
He snatched at it eagerly.
“And now go at once, please,” said Virginia.
He left the room obediently enough. Through the open door, Virginia
caught a glimpse of George Lomax in the hall, just being ushered
upstairs by Chilvers. As the front door closed, Virginia called to him.
“Come in here, George. Chilvers, bring us tea in here, will you
please?”
She flung open both windows, and George Lomax came into the
room to find her standing erect with dancing eyes and wind-blown
hair.
“I’ll shut them in a minute, George, but I felt the room ought to be
aired. Did you fall over the blackmailer in the hall?”
“The what?”
“Blackmailer, George. B.L.A.C.K.M.A.I.L.E.R? Blackmailer. One who
blackmails.”
“My dear Virginia, you can’t be serious!”
“Oh, but I am, George.”
“But who did he come here to blackmail?”
“Me, George.”
“But, my dear Virginia, what have you been doing?”
“Well, just for once, as it happens, I hadn’t been doing anything.
The good gentleman mistook me for someone else.”
“You rang up the police, I suppose?”
“No, I didn’t. I suppose you think I ought to have done so.”
“Well——” George considered weightily. “No, no, perhaps not—
perhaps you acted wisely. You might be mixed up in some
unpleasant publicity in connection with the case. You might even
have had to give evidence——”
“I should have liked that,” said Virginia. “I would love to be
summoned, and I should like to see if judges really do make all the
rotten jokes you read about. It would be most exciting. I was at Vine
Street the other day to see about a diamond brooch I had lost, and
there was the most perfectly lovely inspector—the nicest man I ever
met.”
George, as was his custom, let all irrelevancies pass.
“But what did you do about this scoundrel?”
“Well, George, I’m afraid I let him do it.”
“Do what?”
“Blackmail me.”
George’s face of horror was so poignant that Virginia had to bite her
under lip.
“You mean—do I understand you to mean—that you did not correct
the misapprehension under which he was labouring?”
Virginia shook her head, shooting a sideways glance at him.
“Good heavens, Virginia, you must be mad.”
“I suppose it would seem that way to you.”
“But why? In God’s name, why?”
“Several reasons. To begin with he was doing it so beautifully—
blackmailing me, I mean—I hate to interrupt an artist when he’s
doing his job really well. And then, you see, I’d never been
blackmailed——”
“I should hope not, indeed.”
“And I wanted to see what it felt like.”
“I am quite at a loss to comprehend you, Virginia.”
“I knew you wouldn’t understand.”
“You did not give him money, I hope?”
“Just a trifle,” said Virginia apologetically.
“How much?”
“Forty pounds.”
“Virginia!”
“My dear George, it’s only what I pay for an evening dress. It’s just
as exciting to buy a new experience as it is to buy a new dress—
more so, in fact.”
George Lomax merely shook his head, and Chilvers appearing at that
moment with the tea urn, he was saved from having to express his
outraged feelings. When tea had been brought in, and Virginia’s deft
fingers were manipulating the heavy silver teapot, she spoke again
on the subject.
“I had another motive too, George—a brighter and better one. We
women are usually supposed to be cats, but at any rate I’d done
another woman a good turn this afternoon. This man isn’t likely to
go off looking for another Virginia Revel. He thinks he’s found his
bird all right. Poor little devil, she was in a blue funk when she wrote
that letter. Mr. Blackmailer would have had the easiest job of his life
there. Now, though he doesn’t know it, he’s up against a tough
proposition. Starting with the great advantage of having led a
blameless life, I shall toy with him to his undoing—as they say in
books. Guile, George, lots of guile.”
George still shook his head.
“I don’t like it,” he persisted. “I don’t like it.”
“Well, never mind, George dear. You didn’t come here to talk about
blackmailers. What did you come here for, by the way? Correct
answer: ‘To see you!’ Accent on the you, and press her hand with
significance unless you happen to have been eating heavily buttered
muffin, in which case it must all be done with the eyes.”
“I did come to see you,” replied George seriously. “And I am glad to
find you alone.”
“Oh, George, this is so sudden,” says she, swallowing a currant.
“I wanted to ask a favour of you. I have always considered you,
Virginia, as a woman of considerable charm.”
“Oh, George!”
“And also a woman of intelligence!”
“Not really? How well the man knows me.”
“My dear Virginia, there is a young fellow arriving in England to-
morrow whom I should like you to meet.”
“All right, George, but it’s your party—let that be clearly understood.”
“You could, I feel sure, if you chose, exercise your considerable
charm.”
Virginia cocked her head a little on one side.
“George, dear, I don’t ‘charm’ as a profession, you know. Often I like
people—and then, well, they like me. But I don’t think I could set
out in cold blood to fascinate a helpless stranger. That sort of thing
isn’t done, George, it really isn’t. There are professional sirens who
would do it much better than I should.”
“That is out of the question, Virginia. This young man, he is a
Canadian, by the way, of the name of McGrath——”
“A Canadian of Scotch descent,” says she, deducing brilliantly.
“Is probably quite unused to the higher walks of English society. I
should like him to appreciate the charm and distinction of a real
English gentlewoman.”
“Meaning me?”
“Exactly.”
“Why?”
“I beg your pardon?”
“I said why? You don’t boom the real English gentlewoman with
every stray Canadian who sets foot upon our shores. What is the
deep idea, George? To put it vulgarly, what do you get out of it?”
“I cannot see that that concerns you, Virginia.”
“I couldn’t possibly go out for an evening and fascinate, unless I
knew all the whys and wherefors.”
“You have a most extraordinary way of putting things, Virginia.
Anyone would think——”
“Wouldn’t they? Come on, George, part with a little more
information.”
“My dear Virginia, matters are likely to be a little strained shortly in a
certain Central European nation. It is important, for reasons which
are immaterial, that this—Mr.—er McGrath should be brought to
realize that the restoring of the Monarchy in Herzoslovakia is
imperative to the peace of Europe.”
“The part about the peace of Europe is all bosh,” said Virginia calmly,
“but I’m all for Monarchies every time, especially for a picturesque
people like the Herzoslovakians. So you’re running a King in the
Herzoslovakian States, are you? Who is he?”
George was reluctant to answer, but did not see his way to avoid the
question. The interview was not going at all as he had planned. He
had foreseen Virginia as a willing, docile tool, receiving his hints
gratefully, and asking no awkward questions. This was far from
being the case. She seemed determined to know all about it and this
George, ever doubtful of female discretion, was determined at all
costs to avoid. He had made a mistake. Virginia was not the woman
for the part. She might, indeed, cause serious trouble. Her account
of her interview with the blackmailer had caused him grave
apprehension. A most undependable creature, with no idea of
treating serious matters seriously.
“Prince Michael Obolovitch,” he replied, as Virginia was obviously
waiting for an answer to her question. “But please let that go no
further.”
“Don’t be absurd, George. There are all sort of hints in the papers
already, and articles cracking up the Obolovitch dynasty and talking
about the murdered Nicholas IV as though he were a cross between
a Saint and a hero instead of a stupid little man besotted by a third-
rate actress.”
George winced. He was more than ever convinced that he had made
a mistake in enlisting Virginia’s aid. He must stave her off quickly.
“You are right, my dear Virginia,” he said hastily, as he rose to his
feet to bid her farewell. “I should not have made the suggestion I
did to you. But we are anxious for the Dominions to see eye to eye
with us on this Herzoslovakian crisis, and McGrath has, I believe,
influence in journalistic circles. As an ardent Monarchist, and with
your knowledge of the country, I thought it a good plan for you to
meet him.”
“So that’s the explanation, is it?”
“Yes, but I dare say you wouldn’t have cared for him.”
Virginia looked at him for a second and then she laughed.
“George,” she said, “you’re a rotten liar.”
“Virginia!”
“Rotten, absolutely rotten! If I had had your training, I could have
managed a better one than that—one that had a chance of being
believed. But I shall find out all about it, my poor George. Rest
assured of that. The Mystery of Mr. McGrath. I shouldn’t wonder if I
got a hint or two at Chimneys this week-end.”
“At Chimneys? You are going to Chimneys?”
George could not conceal his perturbation. He had hoped to reach
Lord Caterham in time for the invitation to remain unissued.
“Bundle rang up and asked me this morning.”
George made a last effort.
“Rather a dull party, I believe,” he said. “Hardly in your line, Virginia.”
“My poor George, why didn’t you tell me the truth and trust me? It’s
still not too late.”
George took her hand and dropped it again limply.
“I have told you the truth,” he said coldly, and he said it without a
blush.
“That’s a better one,” said Virginia approvingly. “But it’s still not good
enough. Cheer up, George, I shall be at Chimneys all right, exerting
my considerable charm—as you put it. Life has become suddenly
very much more amusing. First a blackmailer, and then George in
diplomatic difficulties. Will he tell all to the beautiful woman who
asks for his confidence so pathetically? No, he will reveal nothing
until the last chapter. Good-bye, George. One last fond look before
you go? No? Oh, George, dear, don’t be sulky about it!”
Virginia ran to the telephone as soon as George had departed with a
heavy gait through the front door.
She obtained the number she required and asked to speak to Lady
Eileen Brent.
“Is that you, Bundle? I’m coming to Chimneys all right to-morrow.
What? Bore me? No, it won’t. Bundle, wild horses wouldn’t keep me
away! So there!”
7
Mr. McGrath Refuses an Invitation
The letters were gone!
Having once made up his mind to the fact of their disappearance,
there was nothing to do but accept it. Anthony realized very well
that he could not pursue Giuseppe through the corridors of the Blitz
Hotel. To do so was to court undesired publicity, and in all probability
to fail in his object all the same.
He came to the conclusion that Giuseppe had mistaken the packet of
letters, enclosed as they were in the other wrappings, for the
Memoirs themselves. It was likely therefore that when he discovered
his mistake he would make another attempt to get hold of the
Memoirs. For this attempt Anthony intended to be fully prepared.
Another plan that occurred to him was to advertize discreetly for the
return of the package of letters. Supposing Giuseppe to be an
emissary of the Comrades of the Red Hand, or, which seemed to
Anthony more probable, to be employed by the Loyalist party, the
letters could have no possible interest for either employer and he
would probably jump at the chance of obtaining a small sum of
money for their return.
Having thought out all this, Anthony returned to bed and slept
peacefully until morning. He did not fancy that Giuseppe would be
anxious for a second encounter that night.
Anthony got up with his plan of campaign fully thought out. He had
a good breakfast, glanced at the papers which were full of the new
discoveries of oil in Herzoslovakia, and then demanded an interview
with the manager, and, being Anthony Cade, with a gift for getting
his own way by means of quiet determination, he obtained what he
asked for.
The manager, a Frenchman with an exquisitely suave manner,
received him in his private office.
“You wished to see me, I understand, Mr.—er—McGrath?”
“I did. I arrived at your hotel yesterday afternoon, and I had dinner
served to me in my own rooms by a waiter whose name was
Giuseppe.”
He paused.
“I dare say we have a waiter of that name,” agreed the manager
indifferently.
“I was struck by something unusual in the waiter’s manner, but
thought nothing more of it at the time. Later, in the night, I was
awakened by the sound of some one moving softly about the room.
I switched on the light, and found this same Giuseppe in the act of
rifling my leather suit-case.”
The manager’s indifference had completely disappeared now.
“But I have heard nothing of this,” he exclaimed. “Why was I not
informed sooner?”
“The man and I had a brief struggle—he was armed with a knife by
the way. In the end he succeeded in making off by way of the
window.”
“What did you do then, Mr. McGrath?”
“I examined the contents of my suit-case.”
“Had anything been taken?”
“Nothing of—importance,” said Anthony slowly.
The manager leaned back with a sigh.
“I am glad of that,” he remarked. “But you will allow me to say, Mr.
McGrath, that I do not quite understand your attitude in the matter.
You made no attempt to arouse the hotel? To pursue the thief?”
Anthony shrugged his shoulders.
“Nothing of value had been taken, as I tell you. I am aware, of
course, that strictly speaking it is a case for the police——”
He paused, and the manager murmured without any particular
enthusiasm:
“For the police—of course——”
“In any case, I was fairly certain that the man would manage to
make good his escape, and since nothing was taken why bother with
the police?”
The manager smiled a little.
“I see that you realize, Mr. McGrath, that I am not at all anxious to
have the police called in. From my point of view it is always
disastrous. If the newspapers can get hold of anything connected
with a big fashionable hotel such as this, they always run it for all it
is worth, no matter how insignificant the real subject matter may
be.”
“Quite so,” agreed Anthony. “Now I told you that nothing of value
had been taken, and that was perfectly true in a sense. Nothing of
any value to the thief was taken, but he got hold of something which
is of considerable value to me.”
“Ah?”
“Letters, you understand.”
An expression of superhuman discretion, only to be achieved by a
Frenchman, settled down upon the manager’s face.
“I comprehend,” he murmured. “But perfectly. Naturally, it is not a
matter for the police.”
“We are quite agreed upon that point. But you will understand that I
have every intention of recovering these letters. In the part of the
world where I come from, people are used to doing things for
themselves. What I require from you therefore is the fullest possible
information you can give me about this waiter, Giuseppe.”
“I see no objection to that,” said the manager after a moment or
two’s pause. “I cannot give you the information offhand, of course,
but if you will return in half an hour’s time I will have everything
ready to lay before you.”
“Thank you very much. That will suit me admirably.”
In half an hour’s time, Anthony returned to the office again to find
that the manager had been as good as his word. Jotted down upon
a piece of paper were all the relevant facts known about Giuseppe
Manelli.
“He came to us, you see, about three months ago. A skilled and
experienced waiter. Has given complete satisfaction. He has been in
England about five years.”
Together the two men ran over a list of the hotels and restaurants
where the Italian had worked. One fact struck Anthony as being
possibly of significance. At two of the hotels in question there had
been serious robberies during the time that Giuseppe was employed
there, though no suspicion of any kind had attached to him in either
case. Still, the fact was significant.
Was Giuseppe merely a clever hotel thief? Had his search of
Anthony’s suit-case been merely part of his habitual professional
tactics? He might just possibly have had the packet of letters in his
hand at the moment when Anthony switched on the light, and have
shoved it into his pocket mechanically so as to have his hands free.
In that case, the thing was mere plain or garden robbery.
Against that, there was to be put the man’s excitement of the
evening before when he had caught sight of the papers lying on the
table. There had been no money or object of value there such as
would excite the cupidity of an ordinary thief.
No, Anthony felt convinced that Giuseppe had been acting as a tool
for some outside agency. With the information supplied to him by
the manager, it might be possible to learn something about
Giuseppe’s private life, and so finally track him down. He gathered
up the sheet of paper and rose.
“Thank you very much indeed. It’s quite unnecessary to ask, I
suppose, whether Giuseppe is still in the hotel?”
The manager smiled.
“His bed was not slept in, and all his things have been left behind.
He must have rushed straight out after his attack upon you. I don’t
think there is much chance of our seeing him again.”
“I imagine not. Well, thank you very much indeed. I shall be staying
on here for the present.”
“I hope you will be successful in your task, but I confess that I am
rather doubtful.”
“I always hope for the best.”
One of Anthony’s first proceedings was to question some of the
other waiters who had been friendly with Giuseppe, but he obtained
very little to go upon. He wrote out an advertisement on the lines he
had planned, and had it sent to five of the most widely read
newspapers. He was just about to go out and visit the restaurant at
which Giuseppe had been previously employed when the telephone
rang. Anthony took up the receiver.
“Hullo, what is it?”
A toneless voice replied.
“Am I speaking to Mr. McGrath?”
“You are. Who are you?”
“This is Messrs. Balderson and Hodgkins. Just a minute, please. I will
put you through to Mr. Balderson.”
“Our worthy publishers,” thought Anthony. “So they are getting
worried too, are they? They needn’t. There’s a week to run still.”
A hearty voice struck suddenly upon his ear.
“Hullo! That Mr. McGrath?”
“Speaking.”
“I’m Mr. Balderson of Balderson and Hodgkins. What about that
manuscript, Mr. McGrath?”
“Well,” said Anthony, “what about it?”
“Everything about it. I understand, Mr. McGrath, that you have just
arrived in this country from South Africa. That being so, you can’t
possibly understand the position. There’s going to be trouble about
that manuscript, Mr. McGrath, big trouble. Sometimes I wish we’d
never said we’d handle it.”
“Indeed?”
“I assure you it’s so. At present I’m anxious to get it into my
possession as quickly as possible, so as to have a couple of copies
made. Then, if the original is destroyed—well, no harm will be done.”
“Dear me,” said Anthony.
“Yes, I expect it sounds absurd to you, Mr. McGrath. But, I assure
you, you don’t appreciate the situation. There’s a determined effort
being made to prevent its ever reaching this office. I say to you
quite frankly and without humbug that if you attempt to bring it
yourself it’s ten to one that you’ll never get here.”
“I doubt that,” said Anthony. “When I want to get anywhere, I
usually do.”
“You’re up against a very dangerous lot of people. I wouldn’t have
believed it myself a month ago. I tell you, Mr. McGrath, we’ve been
bribed and threatened and cajoled by one lot and another until we
don’t know whether we’re on our heads or our heels. My suggestion
is that you do not attempt to bring the manuscript here. One of our
people will call upon you at the hotel and take possession of it.”
“And supposing the gang does him in?” asked Anthony.
“The responsibility would then be ours—not yours. You would have
delivered it to our representative and obtained a written discharge.
The cheque for—er—a thousand pounds which we are instructed to
hand to you will not be available until Wednesday next by the terms
of our agreement with the executors of the late—er—author—you
know whom I mean, but if you insist I will send my own cheque for
that amount by the messenger.”
Anthony reflected for a minute or two. He had intended to keep the
Memoirs until the last day of grace, because he was anxious to see
for himself what all the fuss was about. Nevertheless, he realized the
force of the publisher’s arguments.
“All right,” he said, with a little sigh. “Have it your own way. Send
your man along. And if you don’t mind sending that cheque as well
I’d rather have it now, as I may be going out of England before next
Wednesday.”
“Certainly, Mr. McGrath. Our representative will call upon you first
thing to-morrow morning. It will be wiser not to send anyone direct
from the office. Our Mr. Holmes lives in South London. He will call in
on his way to us, and will give you a receipt for the package. I
suggest that to-night you should place a dummy packet in the
manager’s safe. Your enemies will get to hear of this, and it will
prevent any attack being made upon your apartments to-night.”
“Very well, I will do as you direct.”
Anthony hung up the receiver with a thoughtful face.
Then he went on with his interrupted plan of seeking news of the
slippery Giuseppe. He drew a complete blank, however. Giuseppe
had worked at the restaurant in question, but nobody seemed to
know anything of his private life or associates.
“But I’ll get you, my lad,” murmured Anthony, between his teeth. “I’ll
get you yet. It’s only a matter of time.”
His second night in London was entirely peaceful.
At nine o’clock the following morning, the card of Mr. Holmes from
Messrs. Balderson and Hodgkins was sent up, and Mr. Holmes
followed it. A small, fair man with a quiet manner. Anthony handed
over the manuscript, and received in exchange a cheque for a
thousand pounds. Mr. Holmes packed up the manuscript in the small
brown bag he carried, wished Anthony good morning, and departed.
The whole thing seemed very tame.
“But perhaps he’ll be murdered on the way there,” Anthony
murmured aloud, as he stared idly out of the window. “I wonder
now—I very much wonder.”
He put the cheque in an envelope, enclosed a few lines of writing
with it, and sealed it up carefully. Jimmy, who had been more or less
in funds at the time of his encounter with Anthony at Bulawayo, had
advanced him a substantial sum of money which was, as yet,
practically untouched.
“If one’s job’s done with, the other isn’t,” said Anthony to himself.
“Up to now, I’ve bungled it. But never say die. I think that, suitably
disguised, I shall go and have a look at 487, Pont Street.”
He packed his belongings, went down and paid his bill, and ordered
his luggage to be put on a taxi. Suitably rewarding those who stood
in his path, most of whom had done nothing whatever materially to
add to his comfort, he was on the point of being driven off, when a
small boy rushed down the steps with a letter.
“Just come for you, this very minute, sir.”
With a sigh, Anthony produced yet another shilling. The taxi groaned
heavily and jumped forward with a hideous crashing of gears, and
Anthony opened the letter.
It was rather a curious document. He had to read it four times
before he could be sure of what it was all about. Put in plain English
(the letter was not in plain English, but in the peculiar involved style
common to missives issued by Government officials) it presumed
that Mr. McGrath was arriving in England from South Africa to-day—
Thursday, it referred obliquely to the Memoirs of Count Stylptitch,
and begged Mr. McGrath to do nothing in the matter until he had
had a confidential conversation with Mr. George Lomax, and certain
other parties whose magnificence was vaguely hinted at. It also
contained a definite invitation to go down to Chimneys as the guest
of Lord Caterham, on the following day, Friday.
A mysterious and thoroughly obscure communication. Anthony
enjoyed it very much.
“Dear old England,” he murmured affectionately. “Two days behind
the times, as usual. Rather a pity. Still, I can’t go down to Chimneys
under false pretences. I wonder, though, if there’s an inn handy? Mr.
Anthony Cade might stay at the inn without anyone being the wiser.”
He leaned out of the window, and gave new directions to the taxi
driver, who acknowledged them with a snort of contempt.
The taxi drew up before one of London’s more obscure hostelries.
The fare, however, was paid on a scale befitting its point of
departure.
Having booked a room in the name of Anthony Cade, Anthony
passed into a dingy writing-room, took out a sheet of notepaper
stamped with the legend Hotel Blitz, and wrote rapidly.
He explained that he had arrived on the preceding Tuesday, that he
had handed over the manuscript in question to Messrs. Balderson
and Hodgkins, and he regretfully declined the kind invitation of Lord
Caterham as he was leaving England almost immediately. He signed
the letter “Yours faithfully, James McGrath.”
“And now,” said Anthony, as he affixed the stamp to the envelope.
“To business. Exit James McGrath, and Enter Anthony Cade.”
8
A Dead Man
On that same Thursday afternoon Virginia Revel had been playing
tennis at Ranelagh. All the way back to Pont Street, as she lay back
in the long, luxurious limousine, a little smile played upon her lips, as
she rehearsed her part in the forthcoming interview. Of course it was
within the bounds of possibility that the blackmailer might not
reappear, but she felt pretty certain that he would. She had shown
herself an easy prey. Well, perhaps this time there would be a little
surprise for him!
When the car drew up at the house, she turned to speak to the
chauffeur before going up the steps.
“How’s your wife, Walton? I forgot to ask.”
“Better I think, ma’am. The doctor said he’d look in and see her
about half-past six. Will you be wanting the car again?”
Virginia reflected for a minute.
“I shall be away for the week-end. I’m going by the 6.40 from
Paddington, but I shan’t need you again—a taxi will do for that. I’d
rather you saw the doctor. If he thinks it would do your wife good to
go away for the week-end, take her somewhere, Walton. I’ll stand
the expense.”
Cutting short the man’s thanks with an impatient nod of the head,
Virginia ran up the steps, delved into her bag in search of her
latchkey, remembered she hadn’t got it with her, and hastily rang the
bell.
It was not answered at once, but as she waited there a young man
came up the steps. He was shabbily dressed, and carried in his hand
a sheaf of leaflets. He held one out to Virginia with the legend on it
plainly visible: “Why Did I Serve my Country?” In his left hand he
held a collecting-box.
“I can’t buy two of those awful poems in one day,” said Virginia
pleadingly. “I bought one this morning. I did, indeed, honour bright.”
The young man threw back his head and laughed. Virginia laughed
with him. Running her eyes carelessly over him, she thought him a
more pleasing specimen than usual of London’s unemployed. She
liked his brown face, and the lean hardness of him. She went so far
as to wish she had a job for him.
But at that moment the door opened, and immediately Virginia
forgot all about the problem of the unemployed, for to her
astonishment the door was opened by her own maid, Élise.
“Where’s Chilvers?” she demanded sharply, as she stepped into the
hall.
“But he is gone, madame, with the others.”
“What others? Gone where?”
“But to Datchet, madame—to the cottage, as your telegram said.”
“My telegram?” said Virginia, utterly at sea.
“Did not madame send a telegram? Surely there can be no mistake.
It came but an hour ago.”
“I never sent any telegram. What did it say?”
“I believe it is still on the table là-bas.”
Élise retired, pounced upon it, and brought it to her mistress in
triumph.
“Voilà, madame!”
The telegram was addressed to Chilvers and ran as follows:
“Please take household down to cottage at once, and make
preparations for week-end party there. Catch 5.49 train.”
There was nothing unusual about it, it was just the sort of message
she herself had frequently sent before, when she had arranged a
party at her riverside bungalow on the spur of the moment. She
always took the whole household down, leaving an old woman as
caretaker. Chilvers would not have seen anything wrong with the
message, and like a good servant had carried out his orders
faithfully enough.
“Me, I remained,” explained Élise, “knowing that madame would
wish me to pack for her.”
“It’s a silly hoax,” cried Virginia, flinging down the telegram angrily.
“You know perfectly well, Élise, that I am going to Chimneys. I told
you so this morning.”
“I thought madame had changed her mind. Sometimes that does
happen, does it not, madame?”
Virginia admitted the truth of the accusation with a half smile. She
was busy trying to find a reason for this extraordinary practical joke.
Élise cut forward a suggestion.
“Mon Dieu!” she cried, clasping her hands. “If it should be the
malefactors, the thieves! They send the bogus telegram and get the
domestiques all out of the house, and then they rob it.”
“I suppose that might be it,” said Virginia doubtfully.
“Yes, yes, madame, that is it without a doubt. Every day you read in
the papers of such things. Madame will ring up the police at once—
at once—before they arrive and cut our throats.”
“Don’t get so excited, Élise. They won’t come and cut our throats at
six o’clock in the afternoon.”
“Madame, I implore you, let me run out and fetch a policeman now,
at once.”
“What on earth for? Don’t be silly, Élise. Go up and pack my things
for Chimneys if you haven’t already done it. The new Cailleuax
evening dress, and the white crêpe marocain, and—yes, the black
velvet—black velvet is so political, is it not?”
“Madame looks ravishing in the eau de nil satin,” suggested Élise,
her professional instincts reasserting themselves.
“No, I won’t take that. Hurry up, Élise, there’s a good girl. We’ve got
very little time. I’ll send a wire to Chilvers at Datchet, and I’ll speak
to the policeman on the beat as we go out and tell him to keep an
eye on the place. Don’t start rolling your eyes again, Élise—if you
get so frightened before anything has happened, what would you do
if a man jumped out from some dark corner and stuck a knife into
you?”
Élise gave vent to a shrill squeak, and beat a speedy retreat up the
stairs, darting nervous glances over each shoulder as she went.
Virginia made a face at her retreating back, and crossed the hall to
the little study where the telephone was. Élise’s suggestion of
ringing up the police station seemed to her a good one, and she
intended to act upon it without any further delay.
She opened the study door and crossed to the telephone. Then, with
her hand on the receiver, she stopped. A man was sitting in the big
arm-chair, sitting in a curious huddled position. In the stress of the
moment, she had forgotten all about her expected visitor. Apparently
he had fallen asleep whilst waiting for her.
She came right up to the chair, a slightly mischievous smile upon her
face. And then suddenly the smile faded.
The man was not asleep. He was dead.
She knew it at once, knew it instinctively even before her eyes had
seen and noted the small shining pistol lying on the floor, the little-
singed hole just above the heart with the dark stain round it, and
the horrible dropped jaw.
She stood quite still, her hands pressed to her sides. In the silence
she heard Élise running down the stairs.
“Madame! Madame!”
“Well, what is it?”
She moved quickly to the door. Her whole instinct was to conceal
what had happened—for the moment anyway—from Élise. Élise
would promptly go into hysterics, she knew that well enough, and
she felt a great need for calm and quiet in which to think things out.
“Madame, would it not be better if I should draw the chain across
the door? These malefactors, at any minute they may arrive.”
“Yes, if you like. Anything you like.”
She heard the rattle of the chain, and then Élise running upstairs
again, and drew a long breath of relief.
She looked at the man in the chair and then at the telephone. Her
course was quite clear, she must ring up the police at once.
But still she did not do so. She stood quite still, paralysed with horror
and with a host of conflicting ideas rushing through her brain. The
bogus telegram. Had it something to do with this? Supposing Élise
had not stayed behind? She would have let herself in—that is,
presuming she had had her latchkey with her as usual, to find
herself alone in the house with a murdered man—a man whom she
had permitted to blackmail her on a former occasion. Of course she
had an explanation of that; but thinking of that explanation she was
not quite easy in her mind. She remembered how frankly incredible
George had found it. Would other people think the same. Those
letters now—of course she hadn’t written them, but would it be so
easy to prove that?
She put her hands on her forehead, squeezing them tight together.
“I must think,” said Virginia. “I simply must think.”
Who had let the man in? Surely not Élise. If she had done so, she
would have been sure to have mentioned the fact at once. The
whole thing seemed more and more mysterious as she thought
about it. There was really only one thing to be done—ring up the
police.
She stretched out her hand to the telephone, and suddenly she
thought of George. A man—that was what she wanted—an ordinary
level-headed, unemotional man who would see things in their proper
proportion and point out to her the best course to take.
Then she shook her head. Not George. The first thing George would
think of would be his own position. He would hate being mixed up in
this kind of business. George wouldn’t do at all.
Then her face softened. Bill, of course! Without more ado, she rang
up Bill.
She was informed that he had left half an hour ago for Chimneys.
“Oh, damn!” cried Virginia, jamming down the receiver. It was
horrible to be shut up with a dead body and to have no one to speak
to.
And at that minute the front-door bell rang.
Virginia jumped. In a few minutes it rang again. Élise, she knew, was
upstairs packing and wouldn’t hear it.
Virginia went out in the hall, drew back the chain, and undid all the
bolts that Élise had fastened in her zeal. Then, with a long breath,
she threw open the door. On the steps was the unemployed young
man.
Virginia plunged headlong with a relief born of overstrung nerves.
“Come in,” she said. “I think that perhaps I’ve got a job for you.”
She took him into the dining-room, pulled toward a chair for him, sat
down herself facing him, and stared at him very attentively.
“Excuse me,” she said, “but are you—I mean——”
“Eton and Oxford,” said the young man. “That’s what you wanted to
ask me, wasn’t it?”
“Something of the kind,” admitted Virginia.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like