Impractical Python Projects Playful Programming Activities to Make You Smarter 1st Edition Lee Vaughan download
Impractical Python Projects Playful Programming Activities to Make You Smarter 1st Edition Lee Vaughan download
https://textbookfull.com/product/impractical-python-projects-
playful-programming-activities-to-make-you-smarter-1st-edition-
lee-vaughan/
https://textbookfull.com/product/impractical-python-projects-
playful-programming-activities-to-make-you-smarter-1st-edition-
lee-vaughan-2/
https://textbookfull.com/product/python-for-kids-a-playful-
introduction-to-programming-1st-edition-briggs/
https://textbookfull.com/product/real-world-python-a-hacker-s-
guide-to-solving-problems-with-code-1st-edition-lee-vaughan/
https://textbookfull.com/product/python-projects-for-beginners-a-
ten-week-bootcamp-approach-to-python-programming-milliken/
Make Your Own Python Text Adventure: A Guide to
Learning Programming 1st Edition Phillip Johnson
https://textbookfull.com/product/make-your-own-python-text-
adventure-a-guide-to-learning-programming-1st-edition-phillip-
johnson/
https://textbookfull.com/product/efficient-r-programming-a-
practical-guide-to-smarter-programming-1st-edition-colin-
gillespie/
https://textbookfull.com/product/javascript-for-kids-a-playful-
introduction-to-programming-1st-edition-nick-morgan/
https://textbookfull.com/product/bite-size-python-an-
introduction-to-python-programming-1st-edition-april-speight/
https://textbookfull.com/product/investing-between-the-lines-how-
to-make-smarter-decisions-by-decoding-ceo-communications-1st-
edition-l-j-rittenhouse/
IMPRACTICAL PYTHON PROJECTS
Playful Programming Activities to Make You
Smarter
by Lee Vaughan
San Francisco
IMPRACTICAL PYTHON PROJECTS. Copyright © 2019 by Lee Vaughan.
All rights reserved. No part of this work may be reproduced or transmitted in any
form or by any means, electronic or mechanical, including photocopying, recording, or
by any information storage or retrieval system, without the prior written permission of
the copyright owner and the publisher.
ISBN-10: 1-59327-890-X
ISBN-13: 978-1-59327-890-8
The following images are reproduced with permission: Figure 4-1 courtesy of the
Library of Congress; Figure 7-1 created by vecteezy.com; rat silhouette in Figure 7-2
created by vecteezy.com; door image in Figures 11-1, 11-3, 11-4, 11-5, and 11-6 created
by Dooder at Freepik.com; goat and moneybag images in Figures 11-1, 11-4, 11-5, and
11-6 created by Freepik.com; Figures 10-1, 10-7, 13-1, 14-21, and 15-1 from NASA;
satellite images in Figures 14-13 and 14-24 courtesy of www.aha-soft.com/; output in
Figure 12-5 supplied by ifa.com
No Starch Press and the No Starch Press logo are registered trademarks of No Starch
Press, Inc. Other product and company names mentioned herein may be the
trademarks of their respective owners. Rather than use a trademark symbol with every
occurrence of a trademarked name, we are using the names only in an editorial fashion
and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The information in this book is distributed on an “As Is” basis, without warranty.
While every precaution has been taken in the preparation of this work, neither the
author nor No Starch Press, Inc. shall have any liability to any person or entity with
respect to any loss or damage caused or alleged to be caused directly or indirectly by
the information contained in it.
For the Accidental Programmers, the Dedicated Non-Specialists, the
Dibblers and Dabblers: all the non-professionals who find themselves
writing code every day. May this help you on your way.
About the Author
Lee Vaughan is a geologist with more than 30 years of experience in the
petroleum industry. As the Senior Technical Professional for Geological
Modeling at a major international oil company, he was involved in the
construction and review of computer models; the development, testing,
and commercialization of software; and the training of geoscientists and
engineers. An advocate for nonprogrammers who must use
programming in their careers, he wrote Impractical Python Projects to
help self-learners hone their skills with the Python language.
About the Technical Reviewer
Jeremy Kun graduated with his PhD in mathematics from the
University of Illinois at Chicago. He writes the blog Math ∩
Programming (https://jeremykun.com/) and currently works on datacenter
optimization at Google.
BRIEF CONTENTS
Acknowledgments
Introduction
Chapter 1: Silly Name Generator
Chapter 2: Finding Palingram Spells
Chapter 3: Solving Anagrams
Chapter 4: Decoding American Civil War Ciphers
Chapter 5: Encoding English Civil War Ciphers
Chapter 6: Writing in Invisible Ink
Chapter 7: Breeding Giant Rats with Genetic Algorithms
Chapter 8: Counting Syllables for Haiku Poetry
Chapter 9: Writing Haiku with Markov Chain Analysis
Chapter 10: Are We Alone? Exploring the Fermi Paradox
Chapter 11: The Monty Hall Problem
Chapter 12: Securing Your Nest Egg
Chapter 13: Simulating an Alien Volcano
Chapter 14: Mapping Mars with the Mars Orbiter
Chapter 15: Improving Your Astrophotography with Planet Stacking
Chapter 16: Finding Frauds with Benford’s Law
Appendix: Practice Project Solutions
Index
CONTENTS IN DETAIL
ACKNOWLEDGMENTS
INTRODUCTION
Who This Book Is For
What’s in This Book
Python Version, Platform, and IDE
The Code
Coding Style
Where to Get Help
Onward!
1
SILLY NAME GENERATOR
Project #1: Generating Pseudonyms
Planning and Designing a Project
The Strategy
The Pseudocode
The Code
Using the Python Community’s Style Guide
Checking Your Code with Pylint
Describing Your Code with Docstrings
Checking Your Code Style
Summary
Further Reading
Pseudocode
Style Guides
Third-Party Modules
Practice Projects
Pig Latin
Poor Man’s Bar Chart
Challenge Projects
Poor Foreign Man’s Bar Chart
The Middle
Something Completely Different
2
FINDING PALINGRAM SPELLS
Finding and Opening a Dictionary
Handling Exceptions When Opening Files
Loading the Dictionary File
Project #2: Finding Palindromes
The Strategy and Pseudocode
The Palindrome Code
Project #3: Finding Palingrams
The Strategy and Pseudocode
The Palingrams Code
Palingram Profiling
Palingram Optimization
dnE ehT
Further Reading
Practice Project: Dictionary Cleanup
Challenge Project: Recursive Approach
3
SOLVING ANAGRAMS
Project #4: Finding Single-Word Anagrams
The Strategy and Pseudocode
Anagram-Finder Code
Project #5: Finding Phrase Anagrams
The Strategy and Pseudocode
The Anagram Phrase Code
Project #6: Finding Voldemort: The Gallic Gambit
Project #7: Finding Voldemort: The British Brute-Force
Strategy
The British Brute-Force Code
Summary
Further Reading
Practice Project: Finding Digrams
Challenge Project: Automatic Anagram Generator
4
DECODING AMERICAN CIVIL WAR CIPHERS
Project #8: The Route Cipher
The Strategy
The Pseudocode
The Route Cipher Decryption Code
Hacking the Route Cipher
Adding a User Interface
Project #9: The Rail Fence Cipher
The Strategy
The Rail Fence Cipher Encryption Code
The Rail Fence Cipher Decryption Code
Summary
Further Reading
Practice Projects
Hacking Lincoln
Identifying Cipher Types
Storing a Key as a Dictionary
Automating Possible Keys
Route Transposition Cipher: Brute-Force Attack
Challenge Projects
Route Cipher Encoder
Three-Rail Fence Cipher
5
ENCODING ENGLISH CIVIL WAR CIPHERS
Project #10: The Trevanion Cipher
Strategy and Pseudocode
The Trevanion Cipher Code
Project #11: Writing a Null Cipher
The List Cipher Code
The List Cipher Output
Summary
Further Reading
Practice Projects
Saving Mary
The Colchester Catch
6
WRITING IN INVISIBLE INK
Project #12: Hiding a Vigenère Cipher
The Platform
The Strategy
Creating Invisible Ink
Manipulating Word Documents with python-docx
Downloading the Assets
The Pseudocode
The Code
Importing python-docx, Creating Lists, and Adding a
Letterhead
Formatting and Interleaving the Messages
Adding the Vigenère Cipher
Detecting the Hidden Message
Summary
Further Reading
Practice Project: Checking the Number of Blank Lines
Challenge Project: Using Monospace Font
7
BREEDING GIANT RATS WITH GENETIC ALGORITHMS
Finding the Best of All Possible Solutions
Project #13: Breeding an Army of Super-Rats
Strategy
The Super-Rats Code
Summary
Project #14: Cracking a High-Tech Safe
Strategy
The Safecracker Code
Summary
Further Reading
Challenge Projects
Building a Rat Harem
Creating a More Efficient Safecracker
8
COUNTING SYLLABLES FOR HAIKU POETRY
Japanese Haiku
Project #15: Counting Syllables
The Strategy
Using a Corpus
Installing NLTK
Downloading CMUdict
Counting Sounds Instead of Syllables
Handling Words with Multiple Pronunciations
Managing Missing Words
The Training Corpus
The Missing Words Code
The Count Syllables Code
Prepping, Loading, and Counting
Defining the main() Function
A Program to Check Your Program
Summary
Further Reading
Practice Project: Syllable Counter vs. Dictionary File
9
WRITING HAIKU WITH MARKOV CHAIN ANALYSIS
Project #16: Markov Chain Analysis
The Strategy
Choosing and Discarding Words
Continuing from One Line to Another
The Pseudocode
The Training Corpus
Debugging
Building the Scaffolding
Using the logging Module
The Code
Setting Up
Building Markov Models
Choosing a Random Word
Applying the Markov Models
Generating the Haiku Lines
Writing the User Interface
The Results
Good Haiku
Seed Haiku
Summary
Further Reading
Challenge Projects
New Word Generator
Turing Test
Unbelievable! This Is Unbelievable! Unbelievable!
To Haiku, or Not to Haiku
Markov Music
10
ARE WE ALONE? EXPLORING THE FERMI PARADOX
Project #17: Modeling the Milky Way
The Strategy
Estimating the Number of Civilizations
Selecting Radio Bubble Dimensions
Generating a Formula for the Probability of Detection
The Probability-of-Detection Code
Calculating Probability of Detection for a Range of
Civilizations
Generating a Predictive Formula and Checking the Results
Building the Graphical Model
Scaling the Graphical Model
The Galaxy Simulator Code
Results
Summary
Further Reading
Practice Projects
A Galaxy Far, Far Away
Building a Galactic Empire
A Roundabout Way to Predict Detectability
Challenge Projects
Creating a Barred-Spiral Galaxy
Adding Habitable Zones to Your Galaxy
11
THE MONTY HALL PROBLEM
Monte Carlo Simulation
Project #18: Verify vos Savant
The Strategy
The vos Savant Verification Code
Project #19: The Monty Hall Game
A Brief Introduction to Object-Oriented Programming
The Strategy and Pseudocode
Game Assets
The Monty Hall Game Code
Summary
Further Reading
Practice Project: The Birthday Paradox
12
SECURING YOUR NEST EGG
Project #20: Simulating Retirement Lifetimes
The Strategy
Historical Returns Matter
The Greatest Uncertainty
A Qualitative Way to Present Results
The Pseudocode
Finding Historical Data
The Code
Importing Modules and Defining Functions to Load Data and
Get User Input
Getting the User Input
Checking for Other Erroneous Input
Defining the Monte Carlo Engine
Simulating Each Year in a Case
Calculating the Probability of Ruin
Defining and Calling the main() Function
Using the Simulator
Summary
Further Reading
Challenge Projects
A Picture Is Worth a Thousand Dollars
Mix and Match
Just My Luck!
All the Marbles
13
SIMULATING AN ALIEN VOLCANO
Project #21: The Plumes of Io
A Slice of pygame
The Strategy
Using a Game Sketch to Plan
Planning the Particle Class
The Code
Importing Modules, Initiating pygame, and Defining Colors
Defining the Particle Class
Ejecting a Particle
Updating the Particle and Handling Boundary Conditions
Defining the main() Function
Completing the main() Function
Running the Simulation
Summary
Further Reading
Practice Project: Going the Distance
Challenge Projects
Shock Canopy
The Fountainhead
With a Bullet
14
MAPPING MARS WITH THE MARS ORBITER
Astrodynamics for Gamers
The Law of Universal Gravity
Kepler’s Laws of Planetary Motion
Orbital Mechanics
Project #22: The Mars Orbiter Game
The Strategy
Game Assets
The Code
Importing and Building a Color Table
Defining the Satellite Class Initialization Method
Setting the Satellite’s Initial Position, Speed, Fuel, and Sound
Firing Thrusters and Checking for Player Input
Locating the Satellite
Rotating the Satellite and Drawing Its Orbit
Updating the Satellite Object
Defining the Planet Class Initialization Method
Rotating the Planet
Defining the gravity() and update() Methods
Calculating Eccentricity
Defining Functions to Make Labels
Mapping Soil Moisture
Casting a Shadow
Defining the main() Function
Instantiating Objects, Setting Up Orbit Verification, Mapping,
and Timekeeping
Starting the Game Loop and Playing Sounds
Applying Gravity, Calculating Eccentricity, and Handling
Failure
Rewarding Success and Updating and Drawing Sprites
Displaying Instructions and Telemetry and Casting a Shadow
Summary
Challenge Projects
Game Title Screen
Smart Gauges
Radio Blackout
Scoring
Strategy Guide
Aerobraking
Intruder Alert!
Over the Top
15
IMPROVING YOUR ASTROPHOTOGRAPHY WITH PLANET
STACKING
Project #23: Stacking Jupiter
The pillow Module
Working with Files and Folders
Directory Paths
The Shell Utilities Module
The Video
The Strategy
The Code
The Cropping and Scaling Code
The Stacking Code
The Enhancing Code
Summary
Further Reading
Challenge Project: Vanishing Act
16
FINDING FRAUDS WITH BENFORD’S LAW
Project #24: Benford’s Law of Leading Digits
Applying Benford’s Law
Performing the Chi-Square Test
The Dataset
The Strategy
The Code
Importing Modules and Loading Data
Counting First Digits
Getting the Expected Counts
Determining Goodness of Fit
Defining the Bar Chart Function
Completing the Bar Chart Function
Defining and Running the main() Function
Summary
Further Reading
Practice Project: Beating Benford
Challenge Projects
Benfording the Battlegrounds
While No One Was Looking
APPENDIX
PRACTICE PROJECT SOLUTIONS
Chapter 1: Silly Name Generator
Chapter 2: Finding Palingram Spells
Chapter 3: Solving Anagrams
Chapter 4: Decoding American Civil War Ciphers
Chapter 5: Encoding English Civil War Ciphers
Chapter 6: Writing in Invisible Ink
Chapter 8: Counting Syllables for Haiku Poetry
Chapter 10: Are We Alone? Exploring the Fermi Paradox
Chapter 11: The Monty Hall Problem
Chapter 13: Simulating an Alien Volcano
Chapter 16: Finding Frauds with Benford’s Law
INDEX
ACKNOWLEDGMENTS
The Code
Every line of code is provided for each project in this book, and I
recommend you enter it by hand whenever possible. A college professor
once told me that we “learn through our hands,” and I have to agree
that keying in code forces you to pay maximum attention to what’s
going on.
But if you want to complete a project quickly or you accidentally
delete all your work, you can download all of the code, including
solutions to the Practice Projects, from
https://www.nostarch.com/impracticalpython/.
Coding Style
This book is about problem solving and beginner-level fun, so the code
may deviate at times from best practices and peak efficiency.
Occasionally, you may use list comprehension or a special operator, but
for the most part, you’ll focus on simple, approachable code that’s easy
to learn.
Keeping things simple is important for the programming
nonprogrammers who read this book. Much of their code may be
“Kleenex code”—used once or twice for a specific purpose and then
thrown away. This is the type of code that might be shared with
colleagues, or thrust upon them during staff changes, so it should be
easy to pick up and understand.
All of the main project code is annotated and explained in a stand-
alone manner, and it generally follows the style recommendations from
Python Enhancement Proposal 8, otherwise known as PEP 8. Details on
PEP 8, and software to help you honor these guidelines, are in Chapter
1.
On the 9th, Lord John Russell introduced his new Reform Bill. Its
provisions may be very briefly stated. The £10 franchise was to be
reduced to £5; the £50 county franchise gives way to one of £20;
that of copyholders and long leaseholders is to be reduced from £10
to £5; and a new class of voters is to be created out of those who,
resident in either county or borough, pay direct taxes to the amount
of 40 shillings. In 67 boroughs additions are proposed to the
electoral boundaries; the property qualification is to be abolished,
and the oaths of members to be put in such a form as to create no
invidious distinctions. A member taking office under the crown
vacates his seat; but if he merely changes it, he may retain his
representative capacity. The Premier made a speech upon the
subject, over an hour in length, and remarkably free from feeling of
any sort. The main objections urged to the bill are that it does not
concede the ballot, that it does not remedy the evils of unequal
representation, and that the changes it does make in the existing
law are of very little importance. Notice has been given of an
intention to move amendments to the bill which would remedy these
defects.——On the 19th, Lord Naas proposed a resolution severely
censuring the Earl of Clarendon's employment of the World
newspaper to support the government, as being "of a nature to
weaken the authority of the executive, and to reflect discredit on the
administration of public affairs." The Earl was defended warmly by
Lords Russell and Palmerston, both of whom urged that, irregular as
the proceeding might have been, it was of trifling consequence
compared with his lordship's eminent services to the country. The
resolution was rejected 229 to 137.——On the 16th, Lord John
Russell introduced a bill for the establishment of a local militia force.
He gave a sketch of the recent history of the military organization of
England, and set forth the reasons which, in his judgment, rendered
it important that some more effectual provision should be made for
the defense of the country against possible hostilities. The general
provisions of the bill were that persons of the age of 20 and 21
years should be subject to being balloted for as militia men—that
one-fifth of the whole number should be chosen—and that they
should be drilled for 14 or 28 days each year. The entire force thus
raised, he thought, would be about 70,000 the first year, 100,000
the second, and 130,000 after that; the forces could not be taken
out of their own counties, without their consent, except in case of
invasion or danger. The subject was very slightly discussed at that
time, but came up again on the 20th, when Lord John Russell again
spoke in support of the bill. Lord Palmerston expressed his entire
concurrence in the principle of the bill, but moved as an
amendment, to strike out the word local from the title, in order to
make the title correspond with the character of the bill itself. Lord
John Russell said he could not understand the object of such a
motion, and that he should oppose it. After some further debate the
amendment was put and carried, ayes 136, noes 125, showing a
majority against the Ministry of 11. Lord John Russell expressed
great surprise at the vote, and said that he should hold office no
longer. The resignation of the Ministry under such circumstances
created a good deal of surprise. In the course of three or four days a
new cabinet was formed under the leadership of the Earl of Derby—
late Lord Stanley—which is thoroughly Protectionist in its sentiments.
The Earl is Prime Minister; Mr. Disraeli is Chancellor of the Exchequer
and leader in the House of Commons; Mr. G. F. Young is Vice
President of the Board of Trade; Duke of Northumberland, first Lord
of the Admiralty; Lord John Manners, Commissioner of Woods and
Forests; Sir F. Thesiger, Attorney General; Earl of Eglintoun, Lord
Lieutenant of Ireland; Duke of Montrose, Lord Steward; Lord
Stanley, Under Secretary for Foreign Affairs. It is supposed that the
new Ministry will break ground at once against the corn-law policy
established by Sir Robert Peel, hostility to which is the only bond of
union among its members; and the universal belief is that the new
administration will fail to be sustained by the country on that
question.
SPAIN.
An attempt to assassinate the Queen of Spain was made by a priest
named Martin Marino, on the 2d of February. The Queen was
proceeding along the principal gallery of her palace toward the
grand staircase, intending to go out upon a fête occasion, for which
splendid preparations had been made, when she was approached by
the priest, who kneeled to present a memorial. Her Majesty reached
out her hand to take it, when he suddenly drew a dirk and made a
stab at her side. Her arm, however, partially averted the blow,
though she was severely wounded. She leaned against the wall, and
one of her aids came up just in time to prevent a second blow. The
assassin was arrested and confessed the crime—saying that his
object was to render a service to humanity; and denying that he had
any accomplices. He was tried on the 3d, and sentenced to death by
strangulation. On the 7th, he was executed by the garote vil. He
conducted himself with the most brutal indifference, refusing any of
the usual offices of religion, and abusing all who came near him. The
Queen suffered considerably from the wound, but was convalescent
at the last accounts. Several arrests had been made, of persons
suspected of having been concerned as accomplices with him, but
no evidence was found to implicate any.
To one who deeply reflects on the fact to which we have been calling
attention, the first feeling, and a just feeling too, might be one of
pride. The dignity of our nature would seem enhanced by such a
constitution. Each man's "mind is his kingdom," in which he may be
as autocratic as he wills. It makes even the lowest in the scale of
humanity such an absolute sovereign within his own spiritual
boundaries, so perfectly secure, if he please, against all foreign
intervention. It sets in so striking a light what in its physical and
etymological, rather than its moral sense, may be styled the holiness
—the wholeness, hale-ness, or separate integrity of each man's
essential being. It is in this point of view, too, that to every hale
mind the pretensions of clairvoyance must appear so inexpressibly
revolting. We allude to its assumption of having the power of
committing what, for the want of a better name, we can only
characterize as spiritual burglary—in other words, of breaking into
our spiritual house, and taking its seat in the very shrine of the
interior consciousness. What can be more degrading to our human
nature than to admit that any other human power, or human will,
can at any time, and from any motive, even for purposes of the most
frivolous amusement, actually enter this inner sanctuary, turning the
immortal spirit into a paltry show-house, and rudely invading, or
pretending to invade, the soul's essential glory, its sacred and
unapproachable individuality?
The parallel may be traced to almost any extent. Like the memory of
our earliest years, so is the dawning history of a young world or
nation, except so far as positive revelation has shed its light upon it.
Both are mythical. In other words, facts are remembered, not as
they are in themselves, but as seen through the magnifying and
coloring influence of the emotional medium with which they are ever
afterward associated. Like stars observed through a densely
refracting atmosphere, they stand apart, each in its own seclusion,
and hence they loom upon the vision without any of those mutually
connecting associations that belong to our subsequent thinking.
There is, too, in both cases, the same chronicler—the pure
remembrance, a tradition unaided by any of those outward helps
that are afterward employed. At a later period more regular annals
succeed this mythic handing down of isolated facts. The state has its
formal remembrancer, its συγγραφεύς, or historical arranger of
events in a connected story, and in their mutual relations.
Corresponding to this, then, arises in the individual that orderly habit
of thinking which produces associations, having a similar effect in
causing a stricter union between the outer and inner relations of the
soul.
Again, there are times when the man gets to himself what may be
called an artificial memory. He would change the natural flow of
thought, and determine what he will remember, and what he ought
to remember—forgetting that before he can effectually do this he
must be changed himself in the innermost springs of his being. He
studies mnemonics. He manufactures new laws of association. But
this effort ever fails in the end. Nature will have her way. The old
course of memory will return; and with it the spiritual history of the
man will go on as before.
So, too, the state or nation may have its artificial periods, and its
systems of political mnemonics. The mythical, the epic, the heroic,
and not only these, but the later, yet not less thrilling chronicles of
stirring events that carried with them the whole heart of the national
humanity, give way to statistics, and documents of trade, or tables of
revenue, or in a word, to what are deemed the more important
records of political economy. Here, too, there may be an attempt to
change the course of nature, and make that to be history which
never can be such, except at the expense of some of those
attributes, which, although liable to great and dangerous
perversions, are still the noblest parts of our humanity.
Some say the world has heretofore been all wrong in the matter.
History has been but a record of wars, of tumultuous national
movements, of theological dogmas, of religious and political
excitements. It has been but the biography of monarchs and royal
families, or a narrative of popular commotions as connected with
them. It has presented us only with names of isolated pre-eminence.
The time has now come when we "must change all that." The daily
pursuits of the masses, and all the statistics of ordinary life—these
ought to have been history, and good writers will henceforth make
them so, not only for our times, but for the periods that are past.
"The history of the world," it has been said, "is yet to be written."
But, alas! for these plausible and philanthropic reforms, there are
two serious obstacles in the way. In the first place, the records of
such matters as they would make the grounds of history are too
scanty and uncertain, because they never have had that catholic
interest which would give them an abiding place in the common
national memory. In the second place, it will be equally difficult to
secure for them such lodgment in the universal thinking of the
present age, or of ages yet to come. Not that the world will always
continue the same, or that there will not be ever new matters of
genuine historical interest. The course of things and thinking may
greatly change. Wars may cease. Monarchy may expire. Even
democracies may become obsolete. Such changes may be for the
better or the worse. Faith may go out. Those religious dogmas and
discussions, which politicians and political economists have regarded
as such useless and troublesome intruders into the province of
history, may lose their hold upon the mind. Still our essential position
remains unchanged. It will not be what the masses severally do but
what moves the masses, not their several occupations and pursuits,
but what has a deep and moving interest for the common national
soul, that will constitute history. The wars of the White and Red
Roses were the true history of England for that period, because they
were the only subjects that could be said to occupy all minds alike.
It was not because the chronicler forgot the masses, and thought
only of the great, but because he wrote for the masses, and for the
masses not only of his own time, but of times to come.
It is what he thinks with others that constitutes the higher life of his
being. Hence the tendency of the popular mind, in all ages, to be
absorbed in the recital of deeds most remote from the daily
associations of ordinary life. Hence the popularity of the rhapsodist,
the minstrel, the chronicler, and, in our own age, of the Magazine
and the Newspaper. Hence, too, in the more free and popular
governments of modern times, the universal devotion to what is
called politics. Why is the farmer more excited by an election than by
the sale of his wheat? Most false as well as unphilosophical is the
view which would ascribe this to any calculating patriotism, to any
utilitarian vigilance, or to what is commonly called an enlightened
self-interest. The mechanic thinks more of politics than of his trade;
for the same reason that led his ancestor to the crusade or the
tournament. Instead of being the offspring of utilitarian views, this
public spirit is often most blindly destructive of the private interest,
and most directly opposed to all the teachings of that political
economy which recognizes its own utilities as alone the true and
rational ends of human action. In a much higher sense, too, is all
this true, when a religious element enters into the common or
catholic feeling.
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.
textbookfull.com