Functional Python Programming: Use A Functional Approach To Write Succinct, Expressive, and Efficient Python Code, 3rd Edition Lott
Functional Python Programming: Use A Functional Approach To Write Succinct, Expressive, and Efficient Python Code, 3rd Edition Lott
com
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/
textbookfull.com
https://textbookfull.com/product/principles-of-foundation-
engineering-9th-edition-si-edition-braja-m-das/
textbookfull.com
On Soulsring Worlds Narrative Complexity Digital
Communities and Interpretation in Dark Souls and Elden
Ring 1st Edition Marco Caracciolo
https://textbookfull.com/product/on-soulsring-worlds-narrative-
complexity-digital-communities-and-interpretation-in-dark-souls-and-
elden-ring-1st-edition-marco-caracciolo/
textbookfull.com
https://textbookfull.com/product/consultation-in-neurourology-a-
practical-evidence-based-guide-1st-edition-jacques-corcos/
textbookfull.com
https://textbookfull.com/product/the-unorthodox-engineers-kapp-colin/
textbookfull.com
https://textbookfull.com/product/advanced-raspberry-pi-raspbian-linux-
and-gpio-integration-1st-edition-warren-gay/
textbookfull.com
https://textbookfull.com/product/engineering-of-thermoplastic-
elastomer-with-graphene-and-other-anisotropic-nanofillers-abhijit-
bandyopadhyay/
textbookfull.com
The Transition from Graduation to Work Challenges and
Strategies in the Twenty First Century Asia Pacific and
Beyond Subas Dhakal
https://textbookfull.com/product/the-transition-from-graduation-to-
work-challenges-and-strategies-in-the-twenty-first-century-asia-
pacific-and-beyond-subas-dhakal/
textbookfull.com
Functional Python
Programming
Third Edition
Steven F. Lott
BIRMINGHAM—MUMBAI
“Python” and the Python logo are trademarks of the Python Software Foundation.
Functional Python Programming
Third Edition
Copyright © 2022 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held
liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing
cannot guarantee the accuracy of this information.
Python is an incredibly versatile language that offers a lot of perks for just about every
group. For the object-oriented programming fans, it has classes and inheritance. When
we talk about functional programming, it has functions as a first-class type, higher-order
functions such as map and reduce, and a handy syntax for comprehensions and generators.
Perhaps best of all, it doesn’t force any of those on the user – it’s still totally OK to write a
script in Python without a single class or function and not feel guilty about it.
Thinking in terms of functional programming, having in mind the goals of minimizing state
and side effects, writing pure functions, reducing intermediary data, and what depends on
what else will also allow you to see your code under a new light. It’ll also allow you to
write more compact, performant, testable, and maintainable code, where instead of writing
a program to solve your problem, you “write the language up”, adding new functions to
it until expressing the solution you designed is simple and straightforward. This is an
extremely powerful mind shift – and an exercise worth doing. It’s a bit like learning a
new language, such as Lisp or Forth (or German, or Irish), but without having to leave the
comfort of your Python environment.
Not being a pure functional language has its costs, however. Python lacks many features
functional languages can use to provide better memory efficiency and speed. Python’s
strongest point remains its accessibility – you can fire up your Python interpreter and
start playing with the examples in this book right away. This interactive approach allows
exploratory programming, where you test ideas easily, and only later need to incorporate
them into a more complex program (or not – like I said, it’s totally OK to write a simple
script).
This book is intended for people already familiar with Python. You don’t need to know
much about functional programming – the book will guide you through many common
approaches, techniques, and patterns used in functional programming and how they can
be best expressed in Python. Think of this book as an introduction – it’ll give you the basic
tools to see, think, and express your ideas in functional terms using Python.
Ricardo Bánffy
Steven has been working with Python since the ‘90s, building a variety of tools and
applications. He’s written a number of titles for Packt Publishing, include Mastering
Object-Oriented Python, Modern Python Cookbook, and Functional Python Programming.
He’s a technomad, and lives on a boat that’s usually located on the east coast of the US. He
tries to live by the words, “Don’t come home until you have a story.”
About the reviewers
Alex Martelli is a Fellow of the Python Software Foundation, a winner of the Frank
Willison Memorial Award for contributions to the Python community, and a top-page
reputation hog on Stack Overflow. He spent 8 years with IBM Research, then 13 years
at Think3 Inc., followed by 4 years as a consultant, and lately 17 years at Google. He
has taught programming languages, development methods, and numerical computing at
Ferrara University and other venues.
Books he has authored or co-authored include two editions of Python Cookbook, four
editions of Python in a Nutshell, and a chapter in Beautiful Teams. Dozens of his interviews
and tech talks at conferences are available on YouTube. Alex’s proudest achievement are
the articles that appeared in Bridge World (January and February 2000), which were hailed
as giant steps towards solving issues that had haunted contract bridge theoreticians for
decades, and still get quoted in current bridge-theoretical literature.
Tiago Antao has a BEng in Informatics and a PhD in Life Sciences. He works in the
Big Data space, analyzing very large datasets and implementing complex data processing
algorithms. He leverages Python with all its libraries to carry out scientific computing and
data engineering tasks. He also uses low-level programming languages like C, C++, and
Rust to optimize critical parts of algorithms. Tiago develops on an infrastructure based on
AWS, but has used on-premises computing and scientific clusters for most of his career.
While he currently works in industry, he also has exposure to the academic side of scientific
computing, with two data analysis postdocs at the universities of Cambridge and Oxford,
and a research scientist position at the University of Montana, where he set up, from
scratch, the scientific computing infrastructure for the analysis of biological data.
Preface xxi
Index 53
Preface
Functional programming offers a variety of techniques for creating succinct and expressive
software. While Python is not a purely functional programming language, we can do a
great deal of functional programming in Python.
Python has a core set of functional programming features. This lets us borrow many design
patterns and techniques from other functional languages. These borrowed concepts can
lead us to create elegant programs. Python’s generator expressions, in particular, negate
the need to create large in-memory data structures, leading to programs that may execute
more quickly because they use fewer resources.
We can’t easily create purely functional programs in Python. Python lacks a number of
features that would be required for this. We don’t have unlimited recursion, for example,
we don’t have lazy evaluation of all expressions, and we don’t have an optimizing compiler.
There are several key features of functional programming languages that are available
in Python. One of the most important ones is the idea of functions being first-class ob-
jects. Python also offers a number of higher-order functions. The built-in map(), filter(),
and functools.reduce() functions are widely used in this role, and less obvious are
functions such as sorted(), min(), and max().
In some cases, a functional approach to a problem will also lead to extremely high-
performance algorithms. Python makes it too easy to create large intermediate data
structures, tying up memory (and processor time). With functional programming de-
sign patterns, we can often replace large lists with generator expressions that are equally
expressive but take up much less memory and run much more quickly.
xxii Preface
We’ll look at the core features of functional programming from a Python point of view.
Our objective is to borrow good ideas from functional programming languages and use
those ideas to create expressive and succinct applications in Python.
This is not intended as a tutorial on Python. This book assumes some familiarity with the
language and the standard library. For a foundational introduction to Python, consider
Learn Python Programming, Third Edition: https://www.packtpub.com/product/learn-p
ython-programming-third-edition/9781801815093.
While we cover the foundations of functional programming, this is not a complete review of
the various kinds of functional programming techniques. Having an exposure to functional
programming in another language can be helpful.
• Library modules to help create functional programs. This is the subject of the
remaining chapters of the book. Chapter 12 includes both fundamental language and
library topics.
Chapter 2, Introducing Essential Functional Concepts, delves into central features of the
functional programming paradigm. We’ll look at each in some detail to see how they’re
implemented in Python. We’ll also point out some features of functional languages that
don’t apply well to Python. In particular, many functional languages have complex type-
matching rules required to support compiling and optimizing.
Chapter 3, Functions, Iterators, and Generators, will show how to leverage immutable Python
objects, and how generator expressions adapt functional programming concepts to the
Python language. We’ll look at some of the built-in Python collections and how we can
leverage them without departing too far from functional programming concepts.
Chapter 4, Working with Collections, shows how you can use a number of built-in Python
functions to operate on collections of data. This chapter will focus on a number of relatively
simple functions, such as any() and all(), which reduce a collection of values to a single
result.
Chapter 6, Recursions and Reductions, teaches how to design an algorithm using recursion
and then optimize it into a high-performance for statement. We’ll also look at some other
reductions that are widely used, including collections.Counter().
Chapter 7, Complex Stateless Objects, showcases a number of ways that we can use immutable
tuples, typing.NamedTuple, and the frozen @dataclass instead of stateful objects. We’ll
also look at the pyrsistent module as a way to create immutable objects. Immutable
objects have a simpler interface than stateful objects: we never have to worry about
abusing an attribute and setting an object into some inconsistent or invalid state.
Chapter 8, The Itertools Module, examines a number of functions in the itertools standard
library module. This collection of functions simplifies writing programs that deal with
collections or generator functions.
xxiv Preface
Chapter 9, Itertools for Combinatorics – Permutations and Combinations, covers the combina-
toric functions in the itertools module. These functions are more specialized than those
in the previous chapter. This chapter includes some examples that illustrate ill-considered
use of these functions and the consequences of combinatoric explosion.
Chapter 10, The Functools Module, focuses on how to use some of the functions in the
functools module for functional programming. A few functions in this module are more
appropriate for building decorators, and they are left for Chapter 12, Decorator Design
Techniques.
Chapter 11, The Toolz Package, covers the toolz package, a number of closely related
modules that help us write functional programs in Python. The toolz modules parallel
the built-in itertools and functools modules, providing alternatives that are often more
sophisticated and make better use of curried functions.
Chapter 12, Decorator Design Techniques, covers how we can look at a decorator as a way
to build a composite function. While there is considerable flexibility here, there are also
some conceptual limitations: we’ll look at ways that overly complex decorators can become
confusing rather than helpful.
Chapter 13, The PyMonad Library, examines some of the features of the PyMonad library.
This provides some additional functional programming features. It also provides a way to
learn more about monads. In some functional languages, monads are an important way to
force a particular order for operations that might get optimized into an undesirable order.
Since Python already has strict ordering of expressions and statements, the monad feature
is more instructive than practical.
Chapter 14, The Multiprocessing, Threading, and Concurrent.Futures Modules, points out
an important consequence of good functional design: we can distribute the processing
workload. Using immutable objects means that we can’t corrupt an object because of poorly
synchronized write operations.
Chapter 15, A Functional Approach to Web Services, shows how we can think of web services
as a nested collection of functions that transform a request into a reply. We’ll see ways to
Random documents with unrelated
content Scribd suggests to you:
of England’s treasure were run dry to buy it. We have waited—we
have not e’en uncovered.”
“Why, then, father, I will set the example. Here! some of you squires
discover me; I have been plated much too long!” and the ready
pages ran forward, and with willing fingers rid the young prince of
his raven harness. They unbuckled and unriveted him, until he stood
before us in the close-fitting quilted black silk that he wore beneath,
and I thought, as I stood back a little way and watched, that never
had I seen a body at once so strong and supple. Then he ran his
hands through his curly black hair, and took his place midway down
the table; the King sat at the head; and when the chaplain had
muttered a Latin grace we fell to work.
It was a merry meal in that ample hall, still littered under the arches
with the broken rubbish of the morning’s fight. The courteous
English King sat smiling under the stranger canopy, and overhead—
rocking in the breeze that came from broken casements—were the
tattered flags our dead foeman’s hands had won in many wars. Our
table shone with heaped splendor shot out from the spoil-carts at
the door; the King’s seneschal blazed behind his chair in cloth of
gold; while honest rough troopers in weather-stained leather and
rusty trappings (pressed on the moment to do squires’ duty) waited
upon us, and ministered, after the fashion of their stalwart
inexperience, to our needs. Amid all those strange surroundings we
talked of wine, and love, and chivalry; we laughed and drank,
tossing off our beakers of red burgundy to the health of that soldier
Sovereign under the daïs, and drank deep bumpers to the gray to-
morrow that was crimsoning the eastern windows ere we had done.
Indeed, we did that night as soldiers do who live in pawn to chance,
and snatch hasty pleasures from the brink of the unknown while the
close foeman’s watch-fires shine upon their faces, and each
forethinks, as the full cups circle, how well he may take his next
meal in Paradise. Of all the courtly badinage and warrior-mirth that
ran round the loaded table while plates were emptied and tankards
turned, but one thing lives in my mind. Truth, ’twas a strange
chance, a most quaint conjunction, that brought that tale about, and
put me there to hear it!
I have said that when the Black Prince entered the banquet hall
there came another knight behind him, a strong, tall young soldier in
glittering mail, something in whose presence set me wondering how
or where we two had met before. Ere I could remember who this
knight might be, the King and Prince were speaking as I have set
down, and then the trumpets blew and we fell to meat and wine
with soldier appetites, and the unknown warrior was forgotten, until
—when the feast was well begun, looking over the rim of a circling
silver goblet of malmsey I was lifting, at a youth who had just taken
the empty place upon my right—there—Jove! how it made me start!
—unhelmeted, unharnessed, lightly nodding to his comrades and all
unwotting of his wondrous neighborhood, was that same Lord
Codrington, that curly-headed gallant who had leaned against me in
the white moonlight of St. Olaf’s cloisters when I was a blessed relic,
a silent, mitered, listening, long-dead miracle!
Gods! you may guess how I did glare at him over the sculptured rim
of that great beaker, the while the red wine stood stagnant at my
lips—and then how my breath did halt and flag as presently he
turned slow and calm upon me, and there—a foot apart—the living
and the dead were face to face, and front to front! I scarce durst
breathe as he took the heavy pledge-cup from my hand—would he
know me? would he leap from his seat with a yell of fear and
wonder, and there, from some distant vantage-point among the
shadowy pillars, with trembling finger impeach me to that startled
table? Hoth! I saw in my mind’s eye those superstitious warriors
tumbling from their places, the while I alone sat gloomy and
remorseful at the littered tressels, and huddling and crowding to the
shadows—as they would not for a thousand Frenchmen—while that
brave boy with chattering teeth and white fingers clutched upon the
kingly arm did, incoherent, tell my tale, and with husky whisper say
how ’twas no soldier of flesh and blood who sat there alone at the
long white table, under the taper lights, self-damned by his solitude!
I waited to see all this, and then that soldier, nothing wotting,
glanced heedlessly over me—he wiped his lips with his napkin, and
took a long draught of the wine within the cup. Then smiling as he
handed it on, and turning lightly round as he laughed, “A very good
tankard, indeed, Sir Stranger—such a one as is some solace for eight
hours in a Flemish saddle! But there was just a little too much
nutmeg in the brew this time—didst thou not think so?”
I murmured some faint agreement, and sat back into my place,
watching the great beaker circle round the table, while my thoughts
idly hovered upon what might have chanced had I been known, and
how I might have vantaged or lost by recognition. Well! the chance
had passed, and I would not take it back. And yet, surely fate was
sporting with me! The cup had scarcely made the circle and been
drained to the last few drops among the novices at the farther end,
when I was again in that very same peril!
“You are new from England, Lord Worringham,” the young Earl said
across me to a knight upon my other hand: “is there late news of
interest to tell us?”
“Hardly one sentence. All the news we had was stale reports of what
you here have done. Men’s minds and eyes have been all upon you,
and each homeward courier has been rifled of his budget at every
port and village on his way by a hundred hungry speculators, as
sharply as though he were a rich wanderer beset by footpads on a
lonely heath. The common people are wild to hear of a great victory,
and will think of nothing else. There is not one other voice in
England—saving, perhaps, that some sleek city merchants do
complain of new assessments, and certain reverend abbots, ’tis said,
of the havoc you have played with this year’s vintage.”
“Yes,” answered the Earl with a laugh, “one can well believe that
last. Sanctity, I have had late cause to know, is thirsty work. Why,
the very Abbot of St. Olaf’s himself, usually esteemed a right
reverend prelate, did charge me at my last confessional to send him
hence some vats of malmsey! No doubt he shrewdly foresaw this
dearth that we are making.”
“What!” exclaimed the other Knight, staring across me. “Hast thou
actually confessed to that bulky saint? Mon Dieu! but you are in luck!
Why, Lord Earl, thou hast disburdened thyself to the wonder of the
age—to the most favored son of Mother Church—the associate of
beatified beings—and the particularly selected of the Apostles! Dost
not know the wonder that has happened to St. Olaf’s?”
“Not a whit. It was ordinary and peaceful when I was there a few
weeks back.”
“Then, by my spurs, there is some news for you! You remember that
wondrous thing they had, that sleeping image that men swore was
an actual living man, and the holy brothers, who, no doubt, were
right, declared was a blessed saint that died three hundred years
ago? You too must know him, Sir,” he said, turning to me, and
looking me full in the face: “you must know him, if you ever were at
St. Olaf’s.”
“Yes,” I answered, calmly returning his gaze. “I have been at St.
Olaf’s at one time or another, and I doubt if any man living knows
that form you speak of better than I do myself.”
“And I,” put in the devout young Earl, “know him too. A holy and
very wondrous body! Surely God’s beneficence still shields him in his
sleep?”
“Shields him! Why, Codrington, he has been translated; removed just
as he was to celestial places; ’tis on the very word of the Abbot
himself we have it, and, where good men meet and talk in England,
no other tale can compete for a moment with this one.”
“Out with it, bold Worringham! Surely such a thing has not
happened since the time of Elijah.”
“’Tis simple enough, and I had it from one who had it from the
Abbot’s lips. That saintly recluse had spent a long day in fast and
vigils amid the cloisters of his ancient abbey—so he said—and when
the evening came had knelt after his wont an hour at the shrine, lost
in holy thought and pious exercise. Nothing new or strange
appeared about the Wonder. It lay as it had ever lain, silent, in the
cathedral twilight, and the good man, full of gentle thoughts and
celestial speculations, if we may take his word for it—and God
forfend I should do otherwise!—the holy father even bent over him
in fraternal love and reverence the while, he says, the beads ran
through his fingers as Ave and Paternoster were told to the sleeping
martyr’s credit by scores and hundreds. Not a sign of life was on the
dead man’s face. He slept and smiled up at the vaulted roof just as
he had done year in and out beyond all memory, and therefore, as
was natural, the Abbot thought he would sleep on while two stones
of the cathedral stood one upon another.
“He left him, and, pacing down the aisles, wended to the refectory,
where the brothers had near done their evening meal, and there,
still in holy meditation, sat him down to break that crust of dry bread
and drink that cup of limpid water which (he told my friend) was his
invariable supper.”
“Hast thou ever seen the reverend father, good Worringham?”
queried a young knight across the table as the story-teller stopped
for a moment to drink from the flagon by his elbow.
“Yes, I have seen him once or twice.”
“Why, so have I,” laughed the young soldier—“and, by all the Saints
in Paradise, I do not believe he sups on husks and water.”
“Believe or not as you will, it is a matter between thyself and
conscience. The Abbot spoke, and I have repeated just what he
said.”
“On with the story, Lord Earl,” laughed another: “we are all open-
mouthed to hear what came next, and even if his Reverence—in
holy abstraction, of course—doth sometime dip fingers into a
venison pasty by mistake for a bread trencher, or gets hold of the
wine-vessel instead of the water-beaker—’tis nothing to us. Suppose
the reverent meal was ended—as Jerome says it should be—in
humble gladness, what came then?”
“What came then?” cried Worringham. “Why, the monks were all
away—the tapers burned low—the Abbot sat there by himself, his
praying hands crossed before him—when wide the chancery door
was flung, and there, in his grave-clothes, white and tall, was the
saint himself!”
Every head was turned as the English knight thus told his story, and,
while the younger soldiers smiled disdainfully, good Codrington at
my side crossed himself again and again, and I saw his soldier lips
trembling as prayer and verse came quick across them.
“Ah! the saint was on foot without a doubt, and it might have chilled
all the breath in a common man to see him stand there alive, and
witful, who had so long been dead and mindless, to meet the light of
those sockets where the eyes had so long been dull! But ’tis a
blessed thing to be an abbot!—to have a heart whiter than one’s
mother’s milk, and a soul of limpid clearness. That holy friar, without
one touch of mortal fear—it is his very own asseveration—rose and
welcomed his noble guest, and sat him in the daïs, and knelt before
him, and adored, and, bold in goodness, waited to be cursed or
canonized—withered by a glance of those eyes no man could safely
look on, or hoist straight to St. Peter’s chair, just as chance should
have it.”
“Wonderful and marvelous!” gasped Codrington, “I would have given
all my lands to have knelt at the bottom of that hall whose top was
sanctified by such a presence.”
“And I,” cried another knight, “would have given this dinted suit of
Milan that I sit in, and a tattered tent somewhere on yonder dark
hillside (the which is all I own of this world), to have been ten miles
away when that same thing happened. Surely it was most dread and
grim, and may Heaven protect all ordinary men if the fashion
spreads with saints!”
“They will not trouble you, no doubt, good comrade. This one rose in
no stern spirit to rebuke, but as the pale commissioner of Heaven to
reward virtue and bless merit. Ill would it beseem me to tell, or you,
common, gross soldiers of the world, to listen to what passed
between those two. ’Twere rank sacrilege to mock the new-risen’s
words by retailing them over a camp table, even though the table be
that of the King himself; and who are we, rough, unruly sons of
Mother Church, that we should submit to repetition the converse of
a prelate with one we scarce dare name!” Whereon Worringham
drank silently from his goblet, and half a dozen knights crossed
themselves devoutly.
“And there is another reason why I should be silent,” he continued.
“The Abbot will not tell what passed between them. Only so much as
this: he gives out with modest hesitance that his holy living and
great attainments had gone straighter to Heaven than the smoke of
Abel’s altar-fire, and thus, on these counts and others, he had been
specially selected for divine favors, and his ancient Church for
miracle. The priest, so the Wonder vowed, must be made a cardinal,
and have next reversion of the Papal chair. Meanwhile pilgrims were
to hold the wonder-shrine of St. Olaf’s no less holy tenantless than
tenanted, to be devout, and above all things liberal, and pray for the
constant intercession of that Messenger who could no longer stay.
Whereon, quoth the Abbot, a wondrous light did daze the watcher’s
sight—unheard, unseen of other men the walls and roof fell wide
apart—and then and there, amid a wondrous hum of voices and
countless shooting stars, that Presence mounted to the sky, and the
Abbot fell fainting on the floor!”
“Truly a strange story, and like to make St. Olaf’s coffers fuller than
King Edward’s are.”
“And to do sterling service to the reverend Prior! What think you,
Sir?” said one, turning to me, who had kept silent all through this
strange medley of fact and cunning fiction. “Is it not a tale that
greatly redounds to the holy father’s credit, and like to do him
material service?”
“No doubt,” I answered, “it will serve the purpose for which ’twas
told. But whether the adventure be truly narrated or not only the
Abbot and he who supped with him can know.”
“Ah!” they laughed, “and, by Our Lady! you may depend upon it the
priest will stick to his version through thick and thin.”
“And by all oaths rolled in one,” I fiercely cried, striking my first upon
the table till the foeman’s silver leaped (for the lying Abbot’s story
had moved my wrath), “by Thor and Odin, by cruel Osiris, by the
bones of Hengist and his brother, that saint will never contradict
him!”
Shortly after we rose, and each on his rough pallet sought the rest a
long day’s work had made so grateful.
Yes! we sought it, but to one, at least, it would not come for long!
Hour after hour I paced in meditation about my tent with folded
arms and bent head, thinking of all that had been or might have
been, and, after that supper of suggestions, the last few weeks rose
up strongly before me. Again and again all that I had seen and done
in that crowded interval swept by my eyes, but the one thing that
stayed while all others faded, the one ever-present shadow among
so many, was the remembrance of the fair, unhappy girl Isobel. Full
of rougher thoughts, I have not once spoken of her, yet, since we
landed on this shore, her winning presence had grown on me every
day I lived, and now to-night, here, close on the eve, as we knew it,
of a desperate battle, wherefrom no man could see the outcome, the
very darkness all about me, after the flickering banquet lights, were
full of Isobel. I laughed and frowned by turn to myself in my lonely
walk that evening, to find how the slighted girl was growing upon
me. Was I a silly squire at a trysting-place, decked out with love-
knots and tokens, a green gallant in a summer wood, full of sighs
and sonnets, to be so witched by the bare memory of a foolish white
wench who had fallen enamored of my swart countenance? It was
idle nonsense; I would not yield. I put it behind me, and thought of
to-morrow—the good King and my jolly comrades—and then there
again was the outline of Isobel’s fair face in the yellow rift of the
evening sky; there were Isobel’s clear eyes fixed, gentle and
reproachful, on me, and the glimmer of her white draperies amid the
shifting shadow of the tent, and even the evening wind outside was
whispering as it came sighing over the wild grass lands—“Isobel!”
Ah! and there was something more behind all that thought of Isobel.
There were eyes that looked from Isobel’s shadowy face, wherever
in my fancy I saw it, that filled me with a strange unrest, and a
whisper behind the whispers of that maiden voice that was hers and
yet was not—a fine thin music that played upon the fibers of my
heart; a presence behind a haunting presence; a meaning behind a
meaning that stirred me with the strangest fancies. And before
another night was over I understood them!
Well, in fact and in deed, I was in love like many another good
soldier, and long did I strive to find a specific for the gentle malady,
but when this might not be—why, I laughed!—the thing itself must
needs be borne; ’twas a common complaint, and no great harm;
when the war was over, I would get back to England, and, if the
maid were still of the same way of thinking—had I not stood a good
many knocks and buffets in the world?—a little ease would do me
good. Ah! a very fair maid—a fair maid, indeed! And her dower some
of the fattest land you could find in a dozen shires!
Thus, schooling myself to think a due entertainment of the malady
were better than a churlish cure, I presently decided to write to the
lady; for, I argued, if to-morrow ends as we hope it may, why, the
letter will be a good word for a homeward traveling hero crowned
with new-plucked bays; and if to-morrow sees me stiff and stark,
down in yon black valley, among to-morrow’s silent ones, still ’twill
be a meet parting, and I owe the maid a word or two of gentleness.
I determined, therefore, to write to her at once a scroll, not of love—
for I was not ripe for that—but of compassion—of just those feelings
that one has to another when the spark of love trembles to the
kindling but is not yet ablaze. And because I did not know my own
mind to any certainty, and because that youth Flamaucœur was both
shrewd and witty—as ready-witted and as nimble, indeed, with
tongue and pen as though he were a woman—I determined it
should be he who should indite that epistle and ease my conscience
of this duty which had grown to be so near a pleasure.
I sent forthwith for Flamaucœur, and he came at once, as was his
wont, sheathed in comely steel from neck to heel, his close-shut
helm upon his head, but all weaponless as usual, save for a toy
dagger at his side.
“Good friend,” I said, “you carry neither sword nor mace. That is not
wise in such a camp as this, and while the Frenchman’s watchfires
smoke upon the eastern sky. But, never mind, I will arm thee myself
for the moment. Here”—passing him the things a writer needs
—“here is a little weapon wherewith they say much mischief has
been done at one time or another in the world, and some sore
wounds taken and given; wield it now for me in kinder sort, and
write me the prettiest epistle thou canst—not too full of harebrained
love or the nonsense that minstrels deal in—but friendly, suave and
gentle, courteous to my lady-love!”
“To whom?” gasped Flamaucœur, stepping back a pace.
“Par Dieu, boy!” I laughed. “I spoke plain enough! Why, thou
consumèd dog in the manger, while thy own heart is confessedly in
condition of eternal combustion, may not another knight even warm
himself by a spark of love without your glowering at him so between
the bars of thine iron muzzle? Come! Why should not I love a maid
as well as you—ah! and write to her a farewell on the eve of battle?”
“Oh! write to whom you will, but I cannot—will not—help you”; and
the youth, who knew nothing of my affections, and to whom I had
never spoken of a woman before, walked away to the tent door and
lifting the flap, looked out over the dim French hills, seeming
marvelous perturbed.
Poor lad, I thought to myself, how soft he is! My love reminds him of
his own, and hence he fears to touch a lover pen. And yet he must.
He can write twice as ingenious, shrewd as I, and no one else could
do this letter half so well. “Come, Flamaucœur! indeed, you must
help me. If you are so sorry over your own reflections, why, the
more reason for lending me thy help. We are companions in this
pretty grief, and should render to each the help due between true
brothers in misfortune. I do assure you I have near broken a maiden
heart back in England.”
“Perhaps she was unworthy of thy love—why should you write?”
“Unworthy! Gods! She was unhappy, she was unfortunate—but
unworthy, never! Why, Flamaucœur, here, as I have been chewing
the cud of reflection all these days, I have begun to think she was
the whitest, sweetest maid that ever breathed.”
“Some pampered, sickly jade, surely, Sir Knight,” murmured the
young man in strange jealous-sounding tones whereof I could not
fail to heed the bitterness; “let her by, she has forgotten thee
mayhap, and taken a new love—those pink-and-white ones were
ever shallow!”
“Shallow! you wayward boy! By Hoth! had you seen our parting you
would not have said so. Why, she wept and clung to me, although
no words of love had ever been between us——”
“A jade, a wanton!” sobbed that strange figure there by the shadowy
tent-flap, whereon, flaming up, “God’s death!” I shouted, “younker,
that goes too far! Curb thy infernal tongue, or neither thy greenness
nor unweaponed state shall save thee from my sword!”
“And I,” quoth Flamaucœur, stepping out before me—“I deride thy
weapon—I will not turn one hair’s breadth from it—here! point it
here, to this heart, dammed and choked with a cruel affection! Oh! I
am wretched and miserable, and eager against all my instincts for
to-morrow’s horrors!”
Whereat that soft and silly youth turned his gorget back upon me
and leaned against the tent-pole most dejectedly. And I was grieved
for him, and spun my angry brand into the farthest corner, and
clapped him on the shoulder, and cheered him as I might, and then,
half mindful to renounce my letter, yet asked him once again.
“Come! thou art steadier now. Wilt thou finally write for me to my
leman?”
“By every saint in Paradise,” groaned the unhappy Flamaucœur, “I
will not!”
“What! not do me a favor and please thy old friend, Isobel of
Oswaldston, at one and the same time?”
“Please whom?” shrieked Flamaucœur, starting like a frightened roe.
“Why, you incomprehensible boy, Isobel of Oswaldston, thy old
playmate, Isobel. Surely I had told thee before it was of her I was
thus newly enamored?”
What passed then within that steel casque I did not know, though
now I well can guess, but that slim gallant turned from me, and
never a word he spoke. A gentle tremor shook him from head to
heel, and I saw the steel plates of his harness quiver with the throes
of his pent emotion, while the blue plumes upon his helmet-top
shook like aspen-leaves in the first breath of a storm, and over the
bars of his cruel visor there rippled a sigh such as surely could only
have come from deep down in a human heart.
All this perplexed me very much and made me thoughtful, but
before I could fashion my suspicions, Flamaucœur mastered his
feelings, and came slowly to the little table, and, saying in a shy,
humble voice, wondrously altered, “I will write to thy maid!” drew off
his steel gauntlet and took up the pen. That smooth, fine hand of his
trembled a little as he spread the paper on the table, and then we
began.
OUR CAMP BY THE SOMME.
August 24, 1376.
To the Excellent Lady Isobel of Oswaldston this brings
greeting and salutation.
Madam: May it please you to accept the homage of the
humblest soldier who serves with King Edward?
“That,” said Flamaucœur, stopping for a moment to sharpen his pen,
“is not a very amorous beginning.”
“No,” I answered, “and I have a mind first only to tell her how we
fare. You see, good youth, our parting was such she weeps in
solitude, I expect, hoping nothing from me, and therefore, I would
wish to break my amendment to her gently. Faith! she may be dying
of love for aught I know, and the shock of a frank avowal of my
new-awakened passion might turn her head.”
“Why yes, Sir Knight,” quoth my comrade, taking a fresh dip of ink,
“or, on the other hand, she may now be footing it to some gay
measure on those polished floors we wot of, or playing hide-and-
seek among the tapestries with certain merry gallants!”
“Jove! If I thought so!”
“Well, never mind. Get on with thy missive, and I will not interrupt
again.”
“There, boy! ’tis not what I meant to say—and very halting, yet she
will guess its meaning. Dost thou not think so?”
“Guess its meaning! Oh, dear comrade, she will live again and feed
upon it—wake and sleep upon it, and wear it next her heart, just as
I should were I she and you were he.”
“But it is so beggarly and poor expressed,” I said, with pleased
humility.
“She will not think so,” cried Flamaucœur. “If I know aught of maids,
she will think it the most blessed vellum that ever was engrossed,
she will like its style better than the wretched culprit likes the style
of the reprieve the steaming horseman flaunts before him. She’ll con
each line and letter, and puncture them with tears and kisses—thou
hast had small ken of maids, I think, sweet soldier!”
“Well! well! It may be so. Do up the letter, since it will read so well,
and put it in the way to be taken by the first messenger who sails
for England. Then we will ride round the posts and see how near the
Frenchman’s watchfires be. And so to sleep, good friend, and may
the many-named Powers which sit on high wake us to a happy to-
morrow!”
CHAPTER XV
A volume might well be written on what I must compress into this
chapter. On the narrow canvas of these few pages must be outlined
the crowded incidents of that noble fight above Crecy, whereof your
historians know but half the truth, and these same lines, charged
with the note of victory, full of the joyful exultation of the mêlée and
dear delight of hard-fought combat—these lines must, too, record
my own illimitable grief.
If while I write you should hear through my poor words aught of the
loud sound of conflict, if you catch aught of the meeting of two great
hosts led on by kingly captains, if the proud neighing of the war-
steeds meet you through these heavy lines and you discern aught of
the thunder of charging squadrons, aught of the singing wind that
plays above a sea of waving plumes as the chivalry of two great
nations rush, like meeting waves, upon each other, so shall you hear,
amid all that joyful tumult, one other sound, one piercing shriek,
wherefrom not endless scores of seasons have cleared my ears.
Listen, then, to the humming bow-strings on the Crecy slopes—to
the stinging hiss of the black rain of English arrows that kept those
heights inviolable—to the rattle of unnumbered spears, breaking like
dry November reeds under the wild hog’s charging feet, as rank
behind rank of English gentlemen rush on the foe! Listen, I say, with
me to the thunderous roar of France’s baffled host, wrecked by its
own mightiness on the sharp edge of English valor, listen to the wild
scream of hireling fear as Doria’s crossbowmen see the English pikes
sweep down upon them; listen to the thunder of proud Alençon
sweeping round our lines with every glittering peer in France behind
him, himself in gemmy armor—a delusive star of victory, riding,
revengeful, on the foremost crest of that wide, sparkling tide! Hear,
if you can, all this, and where my powers fail, lend me the help of
your bold English fancy.