100% found this document useful (2 votes)
18 views

Think Python 1st Edition Allen B. Downey download

The document provides links to download various educational ebooks, including 'Think Python' by Allen B. Downey. It includes information about the book's publication, copyright, and a detailed table of contents outlining the chapters and topics covered. Additionally, it mentions the availability of other related titles by the same author and the publisher's contact information.

Uploaded by

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

Think Python 1st Edition Allen B. Downey download

The document provides links to download various educational ebooks, including 'Think Python' by Allen B. Downey. It includes information about the book's publication, copyright, and a detailed table of contents outlining the chapters and topics covered. Additionally, it mentions the availability of other related titles by the same author and the publisher's contact information.

Uploaded by

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

Think Python 1st Edition Allen B.

Downey pdf
download

https://ebookname.com/product/think-python-1st-edition-allen-b-
downey/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Think Stats Exploratory Data Analysis Second Edition


Allen B. Downey

https://ebookname.com/product/think-stats-exploratory-data-
analysis-second-edition-allen-b-downey/

Think Java How to Think Like a Computer Scientist 1st


Edition Allen B. Downey

https://ebookname.com/product/think-java-how-to-think-like-a-
computer-scientist-1st-edition-allen-b-downey/

Computing handbook computer science and software


engineering 3ed. Edition Allen B Tucker

https://ebookname.com/product/computing-handbook-computer-
science-and-software-engineering-3ed-edition-allen-b-tucker/

The Geometry of Special Relativity 1st Edition Tevian


Dray

https://ebookname.com/product/the-geometry-of-special-
relativity-1st-edition-tevian-dray/
Music in the Holocaust Confronting Life in the Nazi
Ghettos and Camps Oxford Historical Monographs Gilbert

https://ebookname.com/product/music-in-the-holocaust-confronting-
life-in-the-nazi-ghettos-and-camps-oxford-historical-monographs-
gilbert/

The Three Dimensional Navier Stokes Equations Classical


Theory 1st Edition James C. Robinson

https://ebookname.com/product/the-three-dimensional-navier-
stokes-equations-classical-theory-1st-edition-james-c-robinson/

Photoelectrochemical Materials and Energy Conversion


Processes 1st Edition Richard C. Alkire

https://ebookname.com/product/photoelectrochemical-materials-and-
energy-conversion-processes-1st-edition-richard-c-alkire/

Mindfulness 1st Edition Heidegger

https://ebookname.com/product/mindfulness-1st-edition-heidegger/

Where To Retire 7th edition Globe Pequot Press

https://ebookname.com/product/where-to-retire-7th-edition-globe-
pequot-press/
Within the Frame The Journey of Photographic Vision 1st
Edition 2009 David Duchemin

https://ebookname.com/product/within-the-frame-the-journey-of-
photographic-vision-1st-edition-2009-david-duchemin/
Download from Wow! eBook <www.wowebook.com>

Allen B. Downey
Think Python
Think Python
by Allen B. Downey
Copyright © 2012 Allen Downey. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.

O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editors: Mike Loukides and Meghan Blanchette Proofreader: Stacie Arellano
Production Editor: Rachel Steely Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrators: Robert Romano and Rebecca Demarest

August 2012: First Edition

Revision History for the First Edition:

2012-08-03 First release

See http://oreilly.com/catalog/errata.csp?isbn=9781449330729 for release details.

Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. Think Python, the image of a Carolina Parrot, and related trade dress are trademarks of O’Reilly
Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade
mark claim, the designations have been printed in caps or initial caps.
Think Python is available under the Creative Commons Attribution-NonCommercial 3.0 Unported License.
The author maintains an online version at http://thinkpython.com/thinkpython.pdf.

While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.

ISBN: 978-1-449-33072-9
[LSI]
Table of Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

1. The Way of the Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


The Python Programming Language 1
What Is a Program? 3
What Is Debugging? 4
Syntax Errors 4
Runtime Errors 4
Semantic Errors 5
Experimental Debugging 5
Formal and Natural Languages 6
The First Program 7
Debugging 8
Glossary 9
Exercises 11

2. Variables, Expressions, and Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13


Values and Types 13
Variables 14
Variable Names and Keywords 15
Operators and Operands 16
Expressions and Statements 16
Interactive Mode and Script Mode 17
Order of Operations 18
String Operations 18
Comments 19
Debugging 19
Glossary 20

iii
Exercises 21

3. Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Function Calls 23
Type Conversion Functions 23
Math Functions 24
Composition 25
Adding New Functions 25
Definitions and Uses 27
Flow of Execution 27
Parameters and Arguments 28
Variables and Parameters Are Local 29
Stack Diagrams 30
Fruitful Functions and Void Functions 31
Why Functions? 32
Importing with from 32
Debugging 33
Glossary 33
Exercises 35

4. Case Study: Interface Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37


TurtleWorld 37
Simple Repetition 38
Exercises 39
Encapsulation 40
Generalization 41
Interface Design 42
Refactoring 43
A Development Plan 44
Docstring 44
Debugging 45
Glossary 45
Exercises 46

5. Conditionals and Recursion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49


Modulus Operator 49
Boolean Expressions 49
Logical Operators 50
Conditional Execution 50
Alternative Execution 51
Chained Conditionals 51
Nested Conditionals 52

iv | Table of Contents
Recursion 53
Stack Diagrams for Recursive Functions 54
Infinite Recursion 55
Keyboard Input 55
Debugging 56
Glossary 57
Exercises 58

6. Fruitful Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Return Values 61
Incremental Development 62
Composition 64
Boolean Functions 65
More Recursion 66
Leap of Faith 68
One More Example 68
Checking Types 69
Debugging 70
Glossary 71
Exercises 72

7. Iteration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Multiple Assignment 75
Updating Variables 76
The while Statement 76
break 78
Square Roots 79
Algorithms 80
Debugging 81
Glossary 81
Exercises 82

8. Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
A String Is a Sequence 85
len 86
Traversal with a for Loop 86
String Slices 87
Strings Are Immutable 88
Searching 89
Looping and Counting 89
String Methods 90
The in Operator 91

Table of Contents | v
String Comparison 92
Debugging 92
Glossary 94
Exercises 95

9. Case Study: Word Play. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97


Reading Word Lists 97
Exercises 98
Search 99
Looping with Indices 100
Debugging 102
Glossary 102
Exercises 103

10. Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105


A List Is a Sequence 105
Lists Are Mutable 106
Traversing a List 107
List Operations 107
List Slices 108
List Methods 108
Map, Filter, and Reduce 109
Deleting Elements 111
Lists and Strings 112
Objects and Values 112
Aliasing 113
List Arguments 114
Debugging 116
Glossary 117
Exercises 118

11. Dictionaries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121


Dictionary as a Set of Counters 123
Looping and Dictionaries 124
Reverse Lookup 125
Dictionaries and Lists 126
Memos 128
Global Variables 129
Long Integers 130
Debugging 131
Glossary 132

vi | Table of Contents
Exercises 133

12. Tuples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135


Tuples Are Immutable 135
Tuple Assignment 136
Tuples as Return Values 137
Variable-Length Argument Tuples 137
Lists and Tuples 138
Dictionaries and Tuples 139
Comparing Tuples 141
Sequences of Sequences 142
Debugging 143
Glossary 144
Exercises 144

13. Case Study: Data Structure Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147


Word Frequency Analysis 147
Random Numbers 148
Word Histogram 149
Most Common Words 150
Optional Parameters 151
Dictionary Subtraction 151
Random Words 152
Markov Analysis 153
Data Structures 154
Debugging 156
Glossary 157
Exercises 158

14. Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159


Persistence 159
Reading and Writing 159
Format Operator 160
Filenames and Paths 161
Catching Exceptions 162
Databases 163
Pickling 164
Pipes 165
Writing Modules 166
Debugging 167
Glossary 168

Table of Contents | vii


Exercises 169

15. Classes and Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171


User-Defined Types 171
Attributes 172
Rectangles 173
Instances as Return Values 174
Objects Are Mutable 175
Copying 176
Debugging 177
Glossary 178
Exercises 178

16. Classes and Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181


Time 181
Pure Functions 182
Modifiers 183
Prototyping Versus Planning 184
Debugging 185
Glossary 186
Exercises 187

17. Classes and Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189


Object-Oriented Features 189
Printing Objects 190
Another Example 191
A More Complicated Example 192
The init Method 192
The __str__ Method 193
Operator Overloading 194
Type-Based Dispatch 194
Polymorphism 196
Debugging 197
Interface and Implementation 197
Glossary 198
Exercises 199

18. Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201


Card Objects 201
Class Attributes 202
Comparing Cards 204
Decks 205

viii | Table of Contents


Printing the Deck 205
Add, Remove, Shuffle, and Sort 206
Inheritance 207
Class Diagrams 209
Debugging 210
Data Encapsulation 211
Glossary 212
Exercises 213

19. Case Study: Tkinter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217


GUI 217
Buttons and Callbacks 218
Canvas Widgets 219
Coordinate Sequences 220
More Widgets 221
Packing Widgets 222
Menus and Callables 224
Binding 225
Debugging 227
Glossary 229
Exercises 230

A. Debugging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

B. Analysis of Algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

C. Lumpy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265

Table of Contents | ix
Preface

The Strange History of This Book


In January 1999 I was preparing to teach an introductory programming class in Java. I
had taught it three times and I was getting frustrated. The failure rate in the class was
too high and, even for students who succeeded, the overall level of achievement was too
low.
One of the problems I saw was the books. They were too big, with too much unnecessary
detail about Java, and not enough high-level guidance about how to program. And they
all suffered from the trap door effect: they would start out easy, proceed gradually, and
then somewhere around Chapter 5 the bottom would fall out. The students would get
too much new material, too fast, and I would spend the rest of the semester picking up
the pieces.
Two weeks before the first day of classes, I decided to write my own book. My goals
were:
• Keep it short. It is better for students to read 10 pages than not read 50 pages.
• Be careful with vocabulary. I tried to minimize the jargon and define each term at
first use.
• Build gradually. To avoid trap doors, I took the most difficult topics and split them
into a series of small steps.
• Focus on programming, not the programming language. I included the minimum
useful subset of Java and left out the rest.

I needed a title, so on a whim I chose How to Think Like a Computer Scientist.

xi
My first version was rough, but it worked. Students did the reading, and they understood
enough that I could spend class time on the hard topics, the interesting topics and (most
important) letting the students practice.
I released the book under the GNU Free Documentation License, which allows users
to copy, modify, and distribute the book.
What happened next is the cool part. Jeff Elkner, a high school teacher in Virginia,
adopted my book and translated it into Python. He sent me a copy of his translation,
and I had the unusual experience of learning Python by reading my own book. As Green
Tea Press, I published the first Python version in 2001.
In 2003 I started teaching at Olin College and I got to teach Python for the first time.
The contrast with Java was striking. Students struggled less, learned more, worked on
more interesting projects, and generally had a lot more fun.
Over the last nine years I continued to develop the book, correcting errors, improving
some of the examples and adding material, especially exercises.
The result is this book, now with the less grandiose title Think Python. Some of the
changes are:
• I added a section about debugging at the end of each chapter. These sections present
general techniques for finding and avoiding bugs, and warnings about Python
pitfalls.
• I added more exercises, ranging from short tests of understanding to a few sub
stantial projects. And I wrote solutions for most of them.
• I added a series of case studies—longer examples with exercises, solutions, and
discussion. Some are based on Swampy, a suite of Python programs I wrote for use
in my classes. Swampy, code examples, and some solutions are available from http://
thinkpython.com.
• I expanded the discussion of program development plans and basic design patterns.
• I added appendices about debugging, analysis of algorithms, and UML diagrams
with Lumpy.

I hope you enjoy working with this book, and that it helps you learn to program and
think, at least a little bit, like a computer scientist.
—Allen B. Downey
Needham, MA

xii | Preface
Acknowledgments
Many thanks to Jeff Elkner, who translated my Java book into Python, which got this
project started and introduced me to what has turned out to be my favorite language.
Thanks also to Chris Meyers, who contributed several sections to How to Think Like a
Computer Scientist.
Thanks to the Free Software Foundation for developing the GNU Free Documentation
License, which helped make my collaboration with Jeff and Chris possible, and Creative
Commons for the license I am using now.
Thanks to the editors at Lulu who worked on How to Think Like a Computer Scientist.
Thanks to all the students who worked with earlier versions of this book and all the
contributors (listed below) who sent in corrections and suggestions.

Contributor List
More than 100 sharp-eyed and thoughtful readers have sent in suggestions and correc
tions over the past few years. Their contributions, and enthusiasm for this project, have
been a huge help. If you have a suggestion or correction, please send email to feed
back@thinkpython.com. If I make a change based on your feedback, I will add you to
the contributor list (unless you ask to be omitted).
If you include at least part of the sentence the error appears in, that makes it easy for
me to search. Page and section numbers are fine, too, but not quite as easy to work with.
Thanks!
• Lloyd Hugh Allen sent in a correction to Section 8.4.
• Yvon Boulianne sent in a correction of a semantic error in Chapter 5.
• Fred Bremmer submitted a correction in Section 2.1.
• Jonah Cohen wrote the Perl scripts to convert the LaTeX source for this book into beautiful HTML.
• Michael Conlon sent in a grammar correction in Chapter 2 and an improvement in style in Chapter
1, and he initiated discussion on the technical aspects of interpreters.
• Benoit Girard sent in a correction to a humorous mistake in Section 5.6.
• Courtney Gleason and Katherine Smith wrote horsebet.py, which was used as a case study in an
earlier version of the book. Their program can now be found on the website.
• Lee Harr submitted more corrections than we have room to list here, and indeed he should be listed
as one of the principal editors of the text.
• James Kaylin is a student using the text. He has submitted numerous corrections.

Preface | xiii
• David Kershaw fixed the broken catTwice function in Section 3.10.
• Eddie Lam has sent in numerous corrections to Chapters 1, 2, and 3. He also fixed the Makefile so
that it creates an index the first time it is run and helped us set up a versioning scheme.
• Man-Yong Lee sent in a correction to the example code in Section 2.4.
• David Mayo pointed out that the word “unconsciously” in Chapter 1 needed to be changed to
“subconsciously.”
• Chris McAloon sent in several corrections to Sections 3.9 and 3.10.
• Matthew J. Moelter has been a long-time contributor who sent in numerous corrections and sug
gestions to the book.
• Simon Dicon Montford reported a missing function definition and several typos in Chapter 3. He
also found errors in the increment function in Chapter 13.
• John Ouzts corrected the definition of “return value” in Chapter 3.
• Kevin Parks sent in valuable comments and suggestions as to how to improve the distribution of the
book.
• David Pool sent in a typo in the glossary of Chapter 1, as well as kind words of encouragement.
• Michael Schmitt sent in a correction to the chapter on files and exceptions.
• Robin Shaw pointed out an error in Section 13.1, where the printTime function was used in an
example without being defined.
• Paul Sleigh found an error in Chapter 7 and a bug in Jonah Cohen’s Perl script that generates HTML
from LaTeX.
• Craig T. Snydal is testing the text in a course at Drew University. He has contributed several valuable
suggestions and corrections.
• Ian Thomas and his students are using the text in a programming course. They are the first ones to
test the chapters in the latter half of the book, and they have made numerous corrections and
suggestions.
• Keith Verheyden sent in a correction in Chapter 3.
• Peter Winstanley let us know about a longstanding error in our Latin in Chapter 3.
• Chris Wrobel made corrections to the code in the chapter on file I/O and exceptions.
• Moshe Zadka has made invaluable contributions to this project. In addition to writing the first draft
of the chapter on Dictionaries, he provided continual guidance in the early stages of the book.
• Christoph Zwerschke sent several corrections and pedagogic suggestions, and explained the differ
ence between gleich and selbe.
• James Mayer sent us a whole slew of spelling and typographical errors, including two in the con
tributor list.
• Hayden McAfee caught a potentially confusing inconsistency between two examples.

xiv | Preface
• Angel Arnal is part of an international team of translators working on the Spanish version of the
text. He has also found several errors in the English version.
• Tauhidul Hoque and Lex Berezhny created the illustrations in Chapter 1 and improved many of the
other illustrations.
• Dr. Michele Alzetta caught an error in Chapter 8 and sent some interesting pedagogic comments
and suggestions about Fibonacci and Old Maid.
• Andy Mitchell caught a typo in Chapter 1 and a broken example in Chapter 2.
• Kalin Harvey suggested a clarification in Chapter 7 and caught some typos.
• Christopher P. Smith caught several typos and helped us update the book for Python 2.2.
• David Hutchins caught a typo in the Foreword.
• Gregor Lingl is teaching Python at a high school in Vienna, Austria. He is working on a German
translation of the book, and he caught a couple of bad errors in Chapter 5.
• Julie Peters caught a typo in the Preface.
• Florin Oprina sent in an improvement in makeTime, a correction in printTime, and a nice typo.
• D. J. Webre suggested a clarification in Chapter 3.
• Ken found a fistful of errors in Chapters 8, 9 and 11.
• Ivo Wever caught a typo in Chapter 5 and suggested a clarification in Chapter 3.
• Curtis Yanko suggested a clarification in Chapter 2.
• Ben Logan sent in a number of typos and problems with translating the book into HTML.
• Jason Armstrong saw the missing word in Chapter 2.
• Louis Cordier noticed a spot in Chapter 16 where the code didn’t match the text.
• Brian Cain suggested several clarifications in Chapters 2 and 3.
• Rob Black sent in a passel of corrections, including some changes for Python 2.2.
• Jean-Philippe Rey at Ecole Centrale Paris sent a number of patches, including some updates for
Python 2.2 and other thoughtful improvements.
• Jason Mader at George Washington University made a number of useful suggestions and corrections.
• Jan Gundtofte-Bruun reminded us that “a error” is an error.
• Abel David and Alexis Dinno reminded us that the plural of “matrix” is “matrices”, not “matrixes.”
This error was in the book for years, but two readers with the same initials reported it on the same
day. Weird.
• Charles Thayer encouraged us to get rid of the semi-colons we had put at the ends of some statements
and to clean up our use of “argument” and “parameter.”
• Roger Sperberg pointed out a twisted piece of logic in Chapter 3.
• Sam Bull pointed out a confusing paragraph in Chapter 2.

Preface | xv
• Andrew Cheung pointed out two instances of “use before def.”
• C. Corey Capel spotted the missing word in the Third Theorem of Debugging and a typo in
Chapter 4.
• Alessandra helped clear up some Turtle confusion.
• Wim Champagne found a brain-o in a dictionary example.
• Douglas Wright pointed out a problem with floor division in arc.
• Jared Spindor found some jetsam at the end of a sentence.
• Lin Peiheng sent a number of very helpful suggestions.
• Ray Hagtvedt sent in two errors and a not-quite-error.
• Torsten Hübsch pointed out an inconsistency in Swampy.
• Inga Petuhhov corrected an example in Chapter 14.
• Arne Babenhauserheide sent several helpful corrections.
• Mark E. Casida is is good at spotting repeated words.
• Scott Tyler filled in a that was missing. And then sent in a heap of corrections.
• Gordon Shephard sent in several corrections, all in separate emails.
• Andrew Turner spotted an error in Chapter 8.
• Adam Hobart fixed a problem with floor division in arc.
• Daryl Hammond and Sarah Zimmerman pointed out that I served up math.pi too early. And Zim
spotted a typo.
• George Sass found a bug in a Debugging section.
• Brian Bingham suggested Exercise 11-10.
• Leah Engelbert-Fenton pointed out that I used tuple as a variable name, contrary to my own advice.
And then found a bunch of typos and a “use before def.”
• Joe Funke spotted a typo.
• Chao-chao Chen found an inconsistency in the Fibonacci example.
• Jeff Paine knows the difference between space and spam.
• Lubos Pintes sent in a typo.
• Gregg Lind and Abigail Heithoff suggested Exercise 14-4.
• Max Hailperin has sent in a number of corrections and suggestions. Max is one of the authors of the
extraordinary Concrete Abstractions, which you might want to read when you are done with this
book.
• Chotipat Pornavalai found an error in an error message.
• Stanislaw Antol sent a list of very helpful suggestions.

xvi | Preface
• Eric Pashman sent a number of corrections for Chapters 4–11.
• Miguel Azevedo found some typos.
• Jianhua Liu sent in a long list of corrections.
• Nick King found a missing word.
• Martin Zuther sent a long list of suggestions.
• Adam Zimmerman found an inconsistency in my instance of an “instance” and several other errors.
• Ratnakar Tiwari suggested a footnote explaining degenerate triangles.
• Anurag Goel suggested another solution for is_abecedarian and sent some additional corrections.
And he knows how to spell Jane Austen.
• Kelli Kratzer spotted one of the typos.
• Mark Griffiths pointed out a confusing example in Chapter 3.
• Roydan Ongie found an error in my Newton’s method.
• Patryk Wolowiec helped me with a problem in the HTML version.
• Mark Chonofsky told me about a new keyword in Python 3.
• Russell Coleman helped me with my geometry.
• Wei Huang spotted several typographical errors.
• Karen Barber spotted the the oldest typo in the book.
• Nam Nguyen found a typo and pointed out that I used the Decorator pattern but didn’t mention it
by name.
• Stéphane Morin sent in several corrections and suggestions.
• Paul Stoop corrected a typo in uses_only.
• Eric Bronner pointed out a confusion in the discussion of the order of operations.
• Alexandros Gezerlis set a new standard for the number and quality of suggestions he submitted. We
are deeply grateful!
• Gray Thomas knows his right from his left.
• Giovanni Escobar Sosa sent a long list of corrections and suggestions.
• Alix Etienne fixed one of the URLs.
• Kuang He found a typo.
• Daniel Neilson corrected an error about the order of operations.
• Will McGinnis pointed out that polyline was defined differently in two places.
• Swarup Sahoo spotted a missing semi-colon.
• Frank Hecker pointed out an exercise that was under-specified, and some broken links.
• Animesh B helped me clean up a confusing example.

Preface | xvii
• Martin Caspersen found two round-off errors.
• Gregor Ulm sent several corrections and suggestions.

xviii | Preface
CHAPTER 1
The Way of the Program

The goal of this book is to teach you to think like a computer scientist. This way of
thinking combines some of the best features of mathematics, engineering, and natural
science. Like mathematicians, computer scientists use formal languages to denote ideas
(specifically computations). Like engineers, they design things, assembling components
into systems and evaluating tradeoffs among alternatives. Like scientists, they observe
the behavior of complex systems, form hypotheses, and test predictions.
The single most important skill for a computer scientist is problem solving. Problem
solving means the ability to formulate problems, think creatively about solutions, and
express a solution clearly and accurately. As it turns out, the process of learning to
program is an excellent opportunity to practice problem-solving skills. That’s why this
chapter is called, “The way of the program.”
On one level, you will be learning to program, a useful skill by itself. On another level,
you will use programming as a means to an end. As we go along, that end will become
clearer.

The Python Programming Language


The programming language you will learn is Python. Python is an example of a high-
level language; other high-level languages you might have heard of are C, C++, Perl,
and Java.
There are also low-level languages, sometimes referred to as “machine languages” or
“assembly languages.” Loosely speaking, computers can only run programs written in
low-level languages. So programs written in a high-level language have to be processed
before they can run. This extra processing takes some time, which is a small disadvantage
of high-level languages.

1
The advantages are enormous. First, it is much easier to program in a high-level lan
guage. Programs written in a high-level language take less time to write, they are shorter
and easier to read, and they are more likely to be correct. Second, high-level languages
are portable, meaning that they can run on different kinds of computers with few or no
modifications. Low-level programs can run on only one kind of computer and have to
be rewritten to run on another.
Due to these advantages, almost all programs are written in high-level languages. Low-
level languages are used only for a few specialized applications.
Two kinds of programs process high-level languages into low-level languages:
interpreters and compilers. An interpreter reads a high-level program and executes it,
meaning that it does what the program says. It processes the program a little at a time,
alternately reading lines and performing computations. Figure 1-1 shows the structure
of an interpreter.

Figure 1-1. An interpreter processes the program a little at a time, alternately reading lines
and performing computations.

A compiler reads the program and translates it completely before the program starts
running. In this context, the high-level program is called the source code, and the
translated program is called the object code or the executable. Once a program is com
piled, you can execute it repeatedly without further translation. Figure 1-2 shows the
structure of a compiler.

Figure 1-2. A compiler translates source code into object code, which is run by a hardware
executor.

Python is considered an interpreted language because Python programs are executed


by an interpreter. There are two ways to use the interpreter: interactive mode and script
mode. In interactive mode, you type Python programs and the interpreter displays the
result:

2 | Chapter 1: The Way of the Program


>>> 1 + 1
2

The chevron, >>>, is the prompt the interpreter uses to indicate that it is ready. If you
type 1 + 1, the interpreter replies 2.
Alternatively, you can store code in a file and use the interpreter to execute the contents
of the file, which is called a script. By convention, Python scripts have names that end
with .py.
To execute the script, you have to tell the interpreter the name of the file. If you have a
script named dinsdale.py and you are working in a UNIX command window, you type
python dinsdale.py. In other development environments, the details of executing
scripts are different. You can find instructions for your environment at the Python web
site http://python.org.
Working in interactive mode is convenient for testing small pieces of code because you
can type and execute them immediately. But for anything more than a few lines, you
should save your code as a script so you can modify and execute it in the future.

What Is a Program?
A program is a sequence of instructions that specifies how to perform a computation.
The computation might be something mathematical, such as solving a system of equa
tions or finding the roots of a polynomial, but it can also be a symbolic computation,
such as searching and replacing text in a document or (strangely enough) compiling a
program.
The details look different in different languages, but a few basic instructions appear in
just about every language:
input:
Get data from the keyboard, a file, or some other device.
output:
Display data on the screen or send data to a file or other device.
math:
Perform basic mathematical operations like addition and multiplication.
conditional execution:
Check for certain conditions and execute the appropriate code.
repetition:
Perform some action repeatedly, usually with some variation.

What Is a Program? | 3
Believe it or not, that’s pretty much all there is to it. Every program you’ve ever used, no
matter how complicated, is made up of instructions that look pretty much like these. So
you can think of programming as the process of breaking a large, complex task into
smaller and smaller subtasks until the subtasks are simple enough to be performed with
one of these basic instructions.
That may be a little vague, but we will come back to this topic when we talk about
algorithms.

What Is Debugging?
Programming is error-prone. For whimsical reasons, programming errors are called
bugs and the process of tracking them down is called debugging.
Three kinds of errors can occur in a program: syntax errors, runtime errors, and se
mantic errors. It is useful to distinguish between them in order to track them down more
quickly.

Syntax Errors
Python can only execute a program if the syntax is correct; otherwise, the interpreter
displays an error message. Syntax refers to the structure of a program and the rules
about that structure.For example, parentheses have to come in matching pairs, so
(1 + 2) is legal, but 8) is a syntax error.
In English readers can tolerate most syntax errors, which is why we can read the poetry
of e. e. cummings without spewing error messages. Python is not so forgiving. If there
is a single syntax error anywhere in your program, Python will display an error message
and quit, and you will not be able to run your program. During the first few weeks of
your programming career, you will probably spend a lot of time tracking down syntax
errors. As you gain experience, you will make fewer errors and find them faster.

Runtime Errors
The second type of error is a runtime error, so called because the error does not appear
until after the program has started running. These errors are also called exceptions
because they usually indicate that something exceptional (and bad) has happened.
Runtime errors are rare in the simple programs you will see in the first few chapters, so
it might be a while before you encounter one.

4 | Chapter 1: The Way of the Program


Semantic Errors
The third type of error is the semantic error. If there is a semantic error in your program,
it will run successfully in the sense that the computer will not generate any error mes
sages, but it will not do the right thing. It will do something else. Specifically, it will do
what you told it to do.
The problem is that the program you wrote is not the program you wanted to write. The
meaning of the program (its semantics) is wrong. Identifying semantic errors can be
tricky because it requires you to work backward by looking at the output of the program
and trying to figure out what it is doing.

Experimental Debugging
One of the most important skills you will acquire is debugging. Although it can be
frustrating, debugging is one of the most intellectually rich, challenging, and interesting
parts of programming.
In some ways, debugging is like detective work. You are confronted with clues, and you
have to infer the processes and events that led to the results you see.
Debugging is also like an experimental science. Once you have an idea about what is
going wrong, you modify your program and try again. If your hypothesis was correct,
then you can predict the result of the modification, and you take a step closer to a
working program. If your hypothesis was wrong, you have to come up with a new one.
As Sherlock Holmes pointed out, “When you have eliminated the impossible, whatever
remains, however improbable, must be the truth.” (A. Conan Doyle, The Sign of Four)
For some people, programming and debugging are the same thing. That is, program
ming is the process of gradually debugging a program until it does what you want. The
idea is that you should start with a program that does something and make small mod
ifications, debugging them as you go, so that you always have a working program.
For example, Linux is an operating system that contains thousands of lines of code, but
it started out as a simple program Linus Torvalds used to explore the Intel 80386 chip.
According to Larry Greenfield, “One of Linus’s earlier projects was a program that would
switch between printing AAAA and BBBB. This later evolved to Linux.” (The Linux
Users’ Guide Beta Version 1).
Later chapters will make more suggestions about debugging and other programming
practices.

Semantic Errors | 5
Another Random Document on
Scribd Without Any Related Topics
("Καὶ σφι τριξὰ ἐξέυρήματα ἐγένετο—τὰ σημήϊα ποιὲεσθαι.")

"And to them is allowed the invention of three things, which


have come into use among the Greeks:—For the Carians seem
to be the first who put crests upon their helmets and sculptured
devices upon their shields."

2. Calliope, § 74.
("Ὀ δέτερος τῶν λόγων—ἐπίοημον ἄγκυραν.")

"Those who deny this statement assert that he (Sophanes) bare


on his shield, as a device, an anchor."

TACITUS.
(The Annals.—Lib. 1.)
1. ("Tum redire paulatim—in sedes referunt."—Cap. 28.)

"They relinquished the guard of the gates; and the Eagles and
other Ensigns, which in the beginning of the Tumult they had
thrown together, were now restored each to its distinct station."

Potter in his "Antiquities of Greece" (Dunbar's edition, Edinburgh,


1824, vol. ii. page 79), thus speaks of the ensigns or flags (σημεῖα)
used by the Grecians in their military affairs: "Of these there were
different sorts, several of which were adorned with images of
animals, or other things bearing peculiar relations to the cities they
belong to. The Athenians, for instance, bore an owl in their ensigns
(Plutarchus Lysandro), as being sacred to Minerva, the protectress of
their city; the Thebans a Sphynx (idem Pelopidas, Cornelius Nepos,
Epaminondas), in memory of the famous monster overcome by
Œdipus. The Persians paid divine honours to the sun, and therefore
represented him in their ensigns" (Curtius, lib. 3). Again (in page
150), speaking of the ornaments and devices on their ships, he says:
"Some other things there are in the prow and stern that deserve our
notice, as those ornaments wherewith the extremities of the ship
were beautified, commonly called ἀκρονεα (or νεῶν κορωνίδες), in
Latin, Corymbi. The form of them sometimes represented helmets,
sometimes living creatures, but most frequently was winded into a
round compass, whence they are so commonly named Corymbi and
Coronæ. To the ἀκροστόλια in the prow, answered the ἄφγαστα in
the stern, which were often of an orbicular figure, or fashioned like
wings, to which a little shield called ἀσπιδεῖον, or ἀσπιδίσκη, was
frequently affixed; sometimes a piece of wood was erected, whereon
ribbons of divers colours were hung, and served instead of a flag to
distinguish the ship. Χηνίσκος was so called from Χὴν, a Goose,
whose figure it resembled, because geese were looked on as
fortunate omens to mariners, for that they swim on the top of the
waters and sink not. Παράσημον was the flag whereby ships were
distinguished from one another; it was placed in the prow, just
below the στόλος, being sometimes carved, and frequently painted,
whence it is in Latin termed pictura, representing the form of a
mountain, a tree, a flower, or any other thing, wherein it was
distinguished from what was called tutela, or the safeguard of the
ship, which always represented some one of the gods, to whose care
and protection the ship was recommended; for which reason it was
held sacred. Now and then we find the tutela taken for the
Παράσημον, and perhaps sometimes the images of gods might be
represented on the flags; by some it is placed also in the prow, but
by most authors of credit assigned to the stern. Thus Ovid in his
Epistle to Paris:—

'Accipit et pictos puppis adunca Deos.'

'The stern with painted deities richly


shines.'

"The ship wherein Europa was conveyed from Phœnicia into Crete
had a bull for its flag, and Jupiter for its tutelary deity. The Bœotian
ships had for their tutelar god Cadmus, represented with a dragon in
his hand, because he was the founder of Thebes, the principal city of
Bœotia. The name of the ship was usually taken from the flag, as
appears in the following passage of Ovid, where he tells us his ship
received its name from the helmet painted upon it:—

'Est mihi, sitque, precor, flavæ tutela


Minervæ,
Navis et à pictâ casside nomen habit.'

'Minerva is the goddess I adore,


And may she grant the blessings I
implore;
The ship its name a painted helmet
gives.'

"Hence comes the frequent mention of ships called Pegasi, Scyllæ,


Bulls, Rams, Tigers, &c., which the poets took liberty to represent as
living creatures that transported their riders from one country to
another; nor was there (according to some) any other ground for
those known fictions of Pegasus, the winged Bellerophon, or the
Ram which is reported to have carried Phryxus to Colchos."
To quote another very learned author: "The system of hieroglyphics,
or symbols, was adopted into every mysterious institution, for the
purpose of concealing the most sublime secrets of religion from the
prying curiosity of the vulgar; to whom nothing was exposed but the
beauties of their morality." (See Ramsay's "Travels of Cyrus," lib. 3.)
"The old Asiatic style, so highly figurative, seems, by what we find of
its remains in the prophetic language of the sacred writers, to have
been evidently fashioned to the mode of the ancient hieroglyphics;
for as in hieroglyphic writing the sun, moon, and stars were used to
represent states and empires, kings, queens, and nobility—their
eclipse and extinction, temporary disasters, or entire overthrow—fire
and flood, desolation by war and famine; plants or animals, the
qualities of particular persons, &c.; so, in like manner, the Holy
Prophets call kings and empires by the names of the heavenly
luminaries; their misfortunes and overthrow are represented by
eclipses and extinction; stars falling from the firmament are
employed to denote the destruction of the nobility; thunder and
tempestuous winds, hostile invasions; lions, bears, leopards, goats,
or high trees, leaders of armies, conquerors, and founders of
empires; royal dignity is described by purple, or a crown; iniquity by
spotted garments; a warrior by a sword or bow; a powerful man, by
a gigantic stature; a judge by balance, weights, and measures—in a
word, the prophetic style seems to be a speaking hieroglyphic."
It seems to me, however, that the whole of these are no more than
symbolism, though they are undoubtedly symbolism of a high and
methodical order, little removed from our own armory. Personally I
do not consider them to be armory, but if the word is to be stretched
to the utmost latitude to permit of their inclusion, one certain
conclusion follows. That if the heraldry of that day had an orderly
existence, it most certainly came absolutely to an end and
disappeared. Armory as we know it, the armory of to-day, which as a
system is traced back to the period of the Crusades, is no mere
continuation by adoption. It is a distinct development and a re-
development ab initio. Undoubtedly there is a period in the early
development of European civilisation which is destitute alike of
armory, or of anything of that nature. The civilisation of Europe is
not the civilisation of Egypt, of Greece, or of Rome, nor a
continuation thereof, but a new development, and though each of
these in its turn attained a high degree of civilisation and may have
separately developed a heraldic symbolism much akin to armory, as
a natural consequence of its own development, as the armory we
know is a development of its own consequent upon the rise of our
own civilisation, nevertheless it is unjustifiable to attempt to
establish continuity between the ordered symbolism of earlier but
distinct civilisations, and our own present system of armory. The one
and only civilisation which has preserved its continuity is that of the
Jewish race. In spite of persecution the Jews have preserved
unchanged the minutest details of ritual law and ceremony, the
causes of their suffering. Had heraldry, which is and has always been
a matter of pride, formed a part of their distinctive life we should
find it still existing. Yet the fact remains that no trace of Jewish
heraldry can be found until modern times. Consequently I accept
unquestioningly the conclusions of the late J. R. Planché, Somerset
Herald, who unhesitatingly asserted that armory did not exist at the
time of the Conquest, basing his conclusions principally upon the
entire absence of armory from the seals of that period, and the
Bayeux tapestry.

Fig. 1.—Kiku- Fig. 3.—Awoï-


Fig. 2.—Kiri-
non-hana- mon. Mon of
mon. Mon of
mon. State the House of
the Mikado.
Mon of Japan. Minamoto
Tokugawa.

Fig. 4.—Mon of Fig. 5.—Tomoye.


the House of Mon of the House
Minamoto of Arina.
Ashikaya.

The family tokens (mon) of the Japanese, however, fulfil very nearly
all of the essentials of armory, although considered heraldically they
may appear somewhat peculiar to European eyes. Though perhaps
never forming the entire decoration of a shield, they do appear upon
weapons and armour, and are used most lavishly in the decoration of
clothing, rooms, furniture, and in fact almost every conceivable
object, being employed for decorative purposes in precisely the
same manners and methods that armorial devices are decoratively
made use of in this country. A Japanese of the upper classes always
has his mon in three places upon his kimono, usually at the back just
below the collar and on either sleeve. The Japanese servants also
wear their service badge in much the same manner that in olden
days the badge was worn by the servants of a nobleman. The design
of the service badge occupies the whole available surface of the
back, and is reproduced in a miniature form on each lappel of the
kimono. Unfortunately, like armorial bearings in Europe, but to a far
greater extent, the Japanese mon has been greatly pirated and
abused.
Fig. 1, "Kiku-non-hana-mon," formed from the conventionalised
bloom (hana) of the chrysanthemum, is the mon of the State. It is
formed of sixteen petals arranged in a circle, and connected on the
outer edge by small curves.
Fig. 2, "Kiri-mon," is the personal mon of the Mikado, formed of the
leaves and flower of the Paulowna imperialis, conventionally treated.
Fig. 3, "Awoï-mon," is the mon of the House of Minamoto Tokugawa,
and is composed of three sea leaves (Asarum). The Tokugawa
reigned over the country as Shogune from 1603 until the last
revolution in 1867, before which time the Emperor (the Mikado) was
only nominally the ruler.
Fig. 4 shows the mon of the House of Minamoto Ashikaya, which
from 1336 until 1573 enjoyed the Shogunat.
Fig. 5 shows the second mon of the House of Arina, Toymote, which
is used, however, throughout Japan as a sign of luck.
Fig. 6.— Fig. 7.— Fig. 8.—Lily on
Double eagle Device of the the Bab-al-
on a coin Mameluke Hadid gate at
(drachma) Emir Toka Damascus.
under the Timur,
Orthogide of Governor of
Kaifa Naçr Rahaba, 1350.
Edin Mahmud,
1217.

Fig. 9.—Device Fig. 10.—


Fig. 11.—Device
of the Emir Device of the
of Abu
Arkatây (a Mameluke
Abdallah,
band between Emir
Mohammed ibn
two keys). Schaikhu.
Naçr, King of
Granada, said
to be the
builder of the
Alhambra
(1231-1272).

The Saracens and the Moors, to whom we owe the origin of so many
of our recognised heraldic charges and the derivation of some of our
terms (e.g. "gules," from the Persian gul, and "azure" from the
Persian lazurd) had evidently on their part something more than the
rudiments of armory, as Figs. 6 to 11 will indicate.
One of the best definitions of a coat of arms that I know, though this
is not perfect, requires the twofold qualification that the design must
be hereditary and must be connected with armour. And there can be
no doubt that the theory of armory as we now know it is governed
by those two ideas. The shields and the crests, if any decoration of a
helmet is to be called a crest, of the Greeks and the Romans
undoubtedly come within the one requirement. Also were they
indicative of and perhaps intended to be symbolical of the owner.
They lacked, however, heredity, and we have no proof that the
badges we read of, or the decorations of shield and helmet, were
continuous even during a single lifetime. Certainly as we now
understand the term there must be both continuity of use, if the
arms be impersonal, or heredity if the arms be personal. Likewise
must there be their use as decorations of the implements of warfare.
If we exact these qualifications as essential, armory as a fact and as
a science is a product of later days, and is the evolution from the
idea of tribal badges and tribal means and methods of honour
applied to the decoration of implements of warfare. It is the
conjunction and association of these two distinct ideas to which is
added the no less important idea of heredity. The civilisation of
England before the Conquest has left us no trace of any sort or kind
that the Saxons, the Danes, or the Celts either knew or practised
armory. So that if armory as we know it is to be traced to the period
of the Norman Conquest, we must look for it as an adjunct of the
altered civilisation and the altered law which Duke William brought
into this country. Such evidence as exists is to the contrary, and
there is nothing that can be truly termed armorial in that marvellous
piece of cotemporaneous workmanship known as the Bayeux
tapestry.
Concerning the Bayeux tapestry and the evidence it affords,
Woodward and Burnett's "Treatise on Heraldry," apparently following
Planché's conclusions, remarks: "The evidence afforded by the
famous tapestry preserved in the public library of Bayeux, a series of
views in sewed work representing the invasion and conquest of
England by William the Norman, has been appealed to on both sides
of this controversy, and has certainly an important bearing on the
question of the antiquity of coat-armour. This panorama of seventy-
two scenes is on probable grounds believed to have been the work
of the Conqueror's Queen Matilda and her maidens; though the
French historian Thierry and others ascribe it to the Empress Maud,
daughter of Henry III. The latest authorities suggest the likelihood of
its having been wrought as a decoration for the Cathedral of Bayeux,
when rebuilt by William's uterine brother Odo, Bishop of that See, in
1077. The exact correspondence which has been discovered
between the length of the tapestry and the inner circumference of
the nave of the cathedral greatly favours this supposition. This
remarkable work of art, as carefully drawn in colour in 1818 by Mr.
C. Stothard, is reproduced in the sixth volume of the Vetusta
Monumenta; and more recently an excellent copy of it from autotype
plates has been published by the Arundel Society. Each of its scenes
is accompanied by a Latin description, the whole uniting into a
graphic history of the event commemorated. We see Harold taking
leave of Edward the Confessor; riding to Bosham with his hawk and
hounds; embarking for France; landing there and being captured by
the Count of Ponthieu; redeemed by William of Normandy, and in the
midst of his Court aiding him against Conan, Count of Bretagne;
swearing on the sacred relics to recognise William's claim of
succession to the English throne, and then re-embarking for
England. On his return, we have him recounting the incidents of his
journey to Edward the Confessor, to whose funeral obsequies we are
next introduced. Then we have Harold receiving the crown from the
English people, and ascending the throne; and William, apprised of
what had taken place, consulting with his half-brother Odo about
invading England. The war preparations of the Normans, their
embarkation, their landing, their march to Hastings, and formation
of a camp there, form the subjects of successive scenes; and finally
we have the battle of Hastings, with the death of Harold and the
flight of the English. In this remarkable piece of work we have
figures of more than six hundred persons, and seven hundred
animals, besides thirty-seven buildings, and forty-one ships or boats.
There are of course also numerous shields of warriors, of which
some are round, others kite-shaped, and on some of the latter are
rude figures, of dragons or other imaginary animals, as well as
crosses of different forms, and spots. On one hand it requires little
imagination to find the cross patée and the cross botonnée of
heraldry prefigured on two of these shields. But there are several
fatal objections to regarding these figures as incipient armory,
namely that while the most prominent persons of the time are
depicted, most of them repeatedly, none of these is ever
represented twice as bearing the same device, nor is there one
instance of any resemblance in the rude designs described to the
bearings actually used by the descendants of the persons in
question. If a personage so important and so often depicted as the
Conqueror had borne arms, they could not fail to have had a place in
a nearly contemporary work, and more especially if it proceeded
from the needle of his wife."
Lower, in his "Curiosities of Heraldry," clinches the argument when
he writes: "Nothing but disappointment awaits the curious armorist
who seeks in this venerable memorial the pale, the bend, and other
early elements of arms. As these would have been much more easily
imitated with the needle than the grotesque figures before alluded
to, we may safely conclude that personal arms had not yet been
introduced." The "Treatise on Heraldry" proceeds: "The Second
Crusade took place in 1147; and in Montfaucon's plates of the no
longer extant windows of the Abbey of St. Denis, representing that
historical episode, there is not a trace of an armorial ensign on any
of the shields. That window was probably executed at a date when
the memory of that event was fresh; but in Montfaucon's time, the
beginning of the eighteenth century, the Science héroïque was
matter of such moment in France that it is not to be believed that
the armorial figures on the shields, had there been any, would have
been left out."
Surely, if anywhere, we might have expected to have found evidence
of armory, if it had then existed, in the Bayeux Tapestry. Neither do
the seals nor the coins of the period produce a shield of arms. Nor
amongst the host of records and documents which have been
preserved to us do we find any reference to armorial bearings. The
intense value and estimation attached to arms in the fourteenth and
fifteenth centuries, which has steadily though slowly declined since
that period, would lead one to suppose that had arms existed as we
know them at an earlier period, we should have found some definite
record of them in the older chronicles. There are no such references,
and no coat of arms in use at a later date can be relegated to the
Conquest or any anterior period. Of arms, as we know them, there
are isolated examples in the early part of the twelfth century,
perhaps also at the end of the eleventh. At the period of the Third
Crusade (1189) they were in actual existence as hereditary
decorations of weapons of warfare.
Luckily, for the purposes of deductive reasoning, human nature
remains much the same throughout the ages, and, dislike it as we
may, vanity now and vanity in olden days was a great lever in the
determination of human actions. A noticeable result of civilisation is
the effort to suppress any sign of natural emotion; and if the human
race at the present day is not unmoved by a desire to render its
appearance attractive, we may rest very certainly assured that in the
twelfth and thirteenth centuries this motive was even more
pronounced, and still yet more pronounced at a more remote
distance of time. Given an opportunity of ornament, there you will
find ornament and decoration. The ancient Britons, like the Maories
of to-day, found their opportunities restricted to their skins. The
Maories tattoo themselves in intricate patterns, the ancient Britons
used woad, though history is silent as to whether they were content
with flat colour or gave their preference to patterns. It is
unnecessary to trace the art of decoration through embroidery upon
clothes, but there is no doubt that as soon as shields came into use
they were painted and decorated, though I hesitate to follow
practically the whole of heraldic writers in the statement that it was
the necessity for distinction in battle which accounted for the
decoration of shields. Shields were painted and decorated, and
helmets were adorned with all sorts of ornament, long before the
closed helmet made it impossible to recognise a man by his facial
peculiarities and distinctions. We have then this underlying principle
of vanity, with its concomitant result of personal decoration and
adornment. We have the relics of savagery which caused a man to
be nicknamed from some animal. The conjunction of the two
produces the effort to apply the opportunity for decoration and the
vanity of the animal nickname to each other.
We are fast approaching armory. In those days every man fought,
and his weapons were the most cherished of his personal
possessions. The sword his father fought with, the shield his father
carried, the banner his father followed would naturally be amongst
the articles a son would be most eager to possess. Herein are the
rudiments of the idea of heredity in armory; and the science of
armory as we know it begins to slowly evolve itself from that point,
for the son would naturally take a pride in upholding the fame which
had clustered round the pictured signs and emblems under which his
father had warred.
Another element then appeared which exercised a vast influence
upon armory. Europe rang from end to end with the call to the
Crusades. We may or we may not understand the fanaticism which
gripped the whole of the Christian world and sent it forth to fight the
Saracens. That has little to do with it. The result was the collection
together in a comparatively restricted space of all that was best and
noblest amongst the human race at that time. And the spirit of
emulation caused nation to vie with nation, and individual with
individual in the performance of illustrious feats of honour. War was
elevated to the dignity of a sacred duty, and the implements of
warfare rose in estimation. It is easy to understand the glory
therefore that attached to arms, and the slow evolution which I have
been endeavouring to indicate became a concrete fact, and it is due
to the Crusades that the origin of armory as we now know it was
practically coeval throughout Europe, and also that a large
proportion of the charges and terms and rules of heraldry are
identical in all European countries.
The next dominating influence was the introduction, in the early part
of the thirteenth century, of the closed helmet. This hid the face of
the wearer from his followers and necessitated some means by
which the latter could identify the man under whom they served.
What more natural than that they should identify him by the
decoration of his shield and the ornaments of his helmet, and by the
coat or surcoat which he wore over his coat of mail?
This surcoat had afforded another opportunity of decoration, and it
had been decorated with the same signs that the wearer had
painted on his shield, hence the term "coat of arms." This textile
coat was in itself a product of the Crusades. The Crusaders went in
their metal armour from the cooler atmospheres of Europe to the
intolerable heat of the East. The surcoat and the lambrequin alike
protected the metal armour and the metal helmet from the rays of
the sun and the resulting discomfort to the wearer, and were also
found very effective as a preventative of the rust resulting from rain
and damp upon the metal. By the time that the closed helmet had
developed the necessity of distinction and the identification of a man
with the pictured signs he wore or carried, the evolution of armory
into the science we know was practically complete.

CHAPTER II
THE STATUS AND THE MEANING OF A COAT OF ARMS IN GREAT
BRITAIN
It would be foolish and misleading to assert that the possession of a
coat of arms at the present date has anything approaching the
dignity which attached to it in the days of long ago; but one must
trace this through the centuries which have passed in order to form
a true estimate of it, and also to properly appreciate a coat of arms
at the present time. It is necessary to go back to the Norman
Conquest and the broad dividing lines of social life in order to obtain
a correct knowledge. The Saxons had no armory, though they had a
very perfect civilisation. This civilisation William the Conqueror upset,
introducing in its place the system of feudal tenure with which he
had been familiar on the Continent. Briefly, this feudal system may
be described as the partition of the land amongst the barons, earls,
and others, in return for which, according to the land they held, they
accepted a liability of military service for themselves and so many
followers. These barons and earls in their turn sublet the land on
terms advantageous to themselves, but nevertheless requiring from
those to whom they sublet the same military service which the King
had exacted from themselves proportionate with the extent of the
sublet lands. Other subdivisions took place, but always with the
same liability of military service, until we come to those actually
holding and using the lands, enjoying them subject to the liability of
military service attached to those particular lands. Every man who
held land under these conditions—and it was impossible to hold land
without them—was of the upper class. He was nobilis or known, and
of a rank distinct, apart, and absolutely separate from the remainder
of the population, who were at one time actually serfs, and for long
enough afterwards, of no higher social position than they had
enjoyed in their period of servitude. This wide distinction between
the upper and lower classes, which existed from one end of Europe
to the other, was the very root and foundation of armory. It cannot
be too greatly insisted upon. There were two qualitative terms,
"gentle" and "simple," which were applied to the upper and lower
classes respectively. Though now becoming archaic and obsolete,
the terms "gentle" and "simple" are still occasionally to be met with
used in that original sense; and the two adjectives "gentle" and
"simple," in the everyday meanings of the words, are derived from,
and are a later growth from the original usage with the meaning of
the upper and lower classes; because the quality of being gentle was
supposed to exist in that class of life referred to as gentle, whilst the
quality of simplicity was supposed to be an attribute of the lower
class. The word gentle is derived from the Latin word gens (gentilis),
meaning a man, because those were men who were not serfs. Serfs
and slaves were nothing accounted of. The word "gentleman" is a
derivative of the word gentle, and a gentleman was a member of the
gentle or upper class, and gentle qualities were so termed because
they were the qualities supposed to belong to the gentle class. A
man was not a gentleman, even in those days, because he
happened to possess personal qualities usually associated with the
gentle class; a man was a gentleman if he belonged to the gentle or
upper class and not otherwise, so that "gentleman" was an identical
term for one to whom the word nobilis was applied, both being
names for members of the upper class. To all intents and purposes
at that date there was no middle class at all. The kingdom was the
land; and the trading community who dwelt in the towns were of
little account save as milch kine for the purposes of taxation. The
social position conceded to them by the upper class was little, if any,
more than was conceded to the lower classes, whose life and
liberties were held very cheaply. Briefly to sum up, therefore, there
were but the two classes in existence, of which the upper class were
those who held the land, who had military obligations, and who
were noble, or in other words gentle. Therefore all who held land
were gentlemen; because they held land they had to lead their
servants and followers into battle, and they themselves were
personally responsible for the appearance of so many followers,
when the King summoned them to war. Now we have seen in the
previous chapter that arms became necessary to the leader that his
followers might distinguish him in battle. Consequently all who held
land having, because of that land, to be responsible for followers in
battle, found it necessary to use arms. The corollary is therefore
evident, that all who held lands of the King were gentlemen or
noble, and used arms; and as a consequence all who possessed
arms were gentlemen, for they would not need or use arms, nor was
their armour of a character upon which they could display arms,
unless they were leaders. The leaders, we have seen, were the land-
owning or upper class; therefore every one who had arms was a
gentleman, and every gentleman had arms. But the status of
gentlemen existed before there were coats of arms, and the later
inseparable connection between the two was an evolution.
The preposterous prostitution of the word gentleman in these latter
days is due to the almost universal attribute of human nature which
declines to admit itself as of other than gentle rank; and in the eager
desire to write itself gentleman, it has deliberately accepted and
ordained a meaning to the word which it did not formerly possess,
and has attributed to it and allowed it only such a definition as
would enable almost anybody to be included within its ranks.
The word gentleman nowadays has become meaningless as a word
in an ordinary vocabulary; and to use the word with its original and
true meaning, it is necessary to now consider it as purely a technical
term. We are so accustomed to employ the word nowadays in its
unrestricted usage that we are apt to overlook the fact that such a
usage is comparatively modern. The following extract from "The
Right to Bear Arms" will prove that its real meaning was understood
and was decided by law so late as the seventeenth century to be "a
man entitled to bear arms":—

"The following case in the Earl Marshal's Court, which hung


upon the definition of the word, conclusively proves my
contention:—
"'21st November 1637.—W. Baker, gent., humbly sheweth that
having some occasion of conference with Adam Spencer of
Broughton under the Bleane, co. Cant., on or about 28th July
last, the said Adam did in most base and opprobrious tearmes
abuse your petitioner, calling him a base, lying fellow, &c. &c.
The defendant pleaded that Baker is noe Gentleman, and soe
not capable of redresse in this court. Le Neve, Clarenceux, is
directed to examine the point raised, and having done so,
declared as touching the gentry of William Baker, that Robert
Cooke, Clarenceux King of Arms, did make a declaration 10th
May 1573, under his hand and seale of office, that George Baker
of London, sonne of J. Baker of the same place, sonne of Simon
Baker of Feversham, co. Cant., was a bearer of tokens of
honour, and did allow and confirm to the said George Baker and
to his posterity, and to the posterity of Christopher Baker, these
Arms, &c. &c. And further, Le Neve has received proof that the
petitioner, William Baker, is the son of William Baker of
Kingsdowne, co. Cant., who was the brother of George Baker,
and son of Christopher aforesaid.' The judgment is not stated.
(The original Confirmation of Arms by Cooke, 10th May 1573,
may now be seen in the British Museum.—Genealogist for 1889,
p. 242.)"
It has been shown that originally practically all who held land bore
arms. It has also been shown that armory was an evolution, and as
a consequence it did not start, in this country at any rate, as a
ready-made science with all its rules and laws completely known or
promulgated. There is not the slightest doubt that, in the earliest
infancy of the science, arms were assumed and chosen without the
control of the Crown; and one would not be far wrong in assuming
that, so long as the rights accruing from prior appropriation of other
people were respected, a landowner finding the necessity of arms in
battle, was originally at liberty to assume what arms he liked.
That period, however, was of but brief duration, for we find as early
as 1390, from the celebrated Scrope and Grosvenor case, (1) that a
man could have obtained at that time a definite right to his arms, (2)
that this right could be enforced against another, and we find, what
is more important, (3) that the Crown and the Sovereign had
supreme control and jurisdiction over arms, and (4) that the
Sovereign could and did grant arms. From that date down to the
present time the Crown, both by its own direct action and by the
action of the Kings of Arms to whom it delegates powers for the
purpose, in Letters Patent under the Great Seal, specifically issued to
each separate King of Arms upon his appointment, has continued to
grant armorial bearings. Some number of early grants of arms direct
from the Crown have been printed in the Genealogical Magazine,
and some of the earliest distinctly recite that the recipients are made
noble and created gentlemen, and that the arms are given them as
the sign of their nobility. The class of persons to whom grants of
arms were made in the earliest days of such instruments is much the
same as the class which obtain grants of arms at the present day,
and the successful trader or merchant is now at liberty, as he was in
the reign of Henry VIII. and earlier, to raise himself to the rank of a
gentleman by obtaining a grant of arms. A family must make its start
at some time or other; let this start be made honestly, and not by
the appropriation of the arms of some other man.
The illegal assumption of arms began at an early date; and in spite
of the efforts of the Crown, which have been more or less
continuous and repeated, it has been found that the use of "other
people's" arms has continued. In the reign of Henry V. a very
stringent proclamation was issued on the subject; and in the reigns
of Queen Elizabeth and her successors, the Kings of Arms were
commanded to make perambulations throughout the country for the
purpose of pulling down and defacing improper arms, of recording
arms properly borne by authority, and of compelling those who used
arms without authority to obtain authority for them or discontinue
their use. These perambulations were termed Visitations. The
subject of Visitations, and in fact the whole subject of the right to
bear arms, is dealt with at length in the book to which reference has
been already made, namely, "The Right to Bear Arms."
The glory of a descent from a long line of armigerous ancestors, the
glory and the pride of race inseparably interwoven with the
inheritance of a name which has been famous in history, the fact
that some arms have been designed to commemorate heroic
achievements, the fact that the display of a particular coat of arms
has been the method, which society has countenanced, of
advertising to the world that one is of the upper class or a
descendant of some ancestor who performed some glorious deed to
which the arms have reference, the fact that arms themselves are
the very sign of a particular descent or of a particular rank, have all
tended to cause a false and fictitious value to be placed upon all
these pictured emblems which as a whole they have never
possessed, and which I believe they were never intended to possess.
It is because they were the prerogative and the sign of aristocracy
that they have been coveted so greatly, and consequently so often
assumed improperly. Now aristocracy and social position are largely
a matter of personal assertion. A man assumes and asserts for
himself a certain position, which position is gradually and
imperceptibly but continuously increased and elevated as its
assertion is reiterated. There is no particular moment in a man's life
at the present time, the era of the great middle class, at which he
visibly steps from a plebeian to a patrician standing. And when he
has fought and talked the world into conceding him a recognised
position in the upper classes, he naturally tries to obliterate the fact
that he or "his people" were ever of any other social position, and he
hesitates to perpetually date his elevation to the rank of gentility by
obtaining a grant of arms and thereby admitting that before that
date he and his people were plebeian. Consequently he waits until
some circumstance compels an application for a grant, and the
consequence is that he thereby post-dates his actual technical
gentility to a period long subsequent to the recognition by Society of
his position in the upper classes.
Arms are the sign of the technical rank of gentility. The possession of
arms is a matter of hereditary privilege, which privilege the Crown is
willing should be obtained upon certain terms by any who care to
possess it, who live according to the style and custom which is usual
amongst gentle people. And so long as the possession of arms is a
matter of privilege, even though this privilege is no greater than is
consequent upon payment of certain fees to the Crown and its
officers; for so long will that privilege possess a certain prestige and
value, though this may not be very great. Arms have never
possessed any greater value than attaches to a matter of privilege;
and (with singularly few exceptions) in every case, be it of a peer or
baronet, of knight or of simple gentleman, this privilege has been
obtained or has been regularised by the payment at some time or
other of fees to the Crown and its officers. And the only difference
between arms granted and paid for yesterday and arms granted and
paid for five hundred years ago is the simple moral difference which
attaches to the dates at which the payments were made.
Gentility is merely hereditary rank, emanating, with all other rank,
from the Crown, the sole fountain of honour. It is idle to make the
word carry a host of meanings it was never intended to. Arms being
the sign of the technical rank of gentility, the use of arms is the
advertisement of one's claim to that gentility. Arms mean nothing
more. By coronet, supporters, and helmet can be indicated one's
place in the scale of precedence; by adding arms for your wife you
assert that she also is of gentle rank; your quarterings show the
other gentle families you represent; difference marks will show your
position in your own family (not a very important matter);
augmentations indicate the deeds of your ancestors which the
Sovereign thought worthy of being held in especial remembrance. By
the use of a certain coat of arms, you assert your descent from the
person to whom those arms were granted, confirmed, or allowed.
That is the beginning and end of armory. Why seek to make it mean
more?
However heraldry is looked upon, it must be admitted that from its
earliest infancy armory possessed two essential qualities. It was the
definite sign of hereditary nobility and rank, and it was practically an
integral part of warfare; but also from its earliest infancy it formed a
means of decoration. It would be a rash statement to assert that
armory has lost its actual military character even now, but it
certainly possessed it undiminished so long as tournaments took
place, for the armory of the tournament was of a much higher
standard than the armory of the battlefield. Armory as an actual part
of warfare existed as a means of decoration for the implements of
warfare, and as such it certainly continues in some slight degree to
the present day.
Armory in that bygone age, although it existed as the symbol of the
lowest hereditary rank, was worn and used in warfare, for purposes
of pageantry, for the indication of ownership, for decorative
purposes, for the needs of authenticity in seals, and for the purposes
of memorials in records, pedigrees, and monuments. All those uses
and purposes of armory can be traced back to a period coeval with
that to which our certain knowledge of the existence of armory runs.
Of all those usages and purposes, one only, that of the use of
armorial bearings in actual battle, can be said to have come to an
end, and even that not entirely so; the rest are still with us in actual
and extensive existence. I am not versed in the minutiæ of army
matters or army history, but I think I am correct in saying that there
was no such thing as a regular standing army or a national army
until the reign of Henry VIII. Prior to that time the methods of the
feudal system supplied the wants of the country. The actual troops
were in the employment, not of the Crown, but of the individual
leaders. The Sovereign called upon, and had the right to call upon,
those leaders to provide troops; but as those troops were not in the
direct employment of the Crown, they wore the liveries and heraldic
devices of their leaders. The leaders wore their own devices,
originally for decorative reasons, and later that they might be
distinguished by their particular followers: hence the actual use in
battle in former days of private armorial bearings. And even yet the
practice is not wholly extinguished, for the tartans of the Gordon and
Cameron Highlanders are a relic of the usages of these former days.
With the formation of a standing army, and the direct service of the
troops to the Crown, the liveries and badges of those who had
formerly been responsible for the troops gave way to the liveries and
badges of the Crown. The uniform of the Beefeaters is a good
example of the method in which in the old days a servant wore the
badge and livery of his lord. The Beefeaters wear the scarlet livery of
the Sovereign, and wear the badge of the Sovereign still. Many
people will tell you, by the way, that the uniform of a Beefeater is
identical now with what it was in the days of Henry VIII. It isn't. In
accordance with the strictest laws of armory, the badge,
embroidered on the front and back of the tunic, has changed, and is
now the triple badge—the rose, the thistle, and the shamrock—of
the triple kingdom of Great Britain and Ireland. Every soldier who
wears a scarlet coat, the livery of his Sovereign, every regiment that
carries its colours, every saddle-cloth with a Royal emblem
thereupon, is evidence that the use of armory in battle still exists in
a small degree to the present day; but circumstances have altered.
The troops no longer attack to the cry of "A Warwick! a Warwick!"
they serve His Majesty the King and wear his livery and devices.
They no longer carry the banner of their officer, whose servants and
tenants they would formerly have been; the regiment cherishes
instead the banner of the armorial bearings of His Majesty. Within
the last few years, probably within the lifetime of all my readers,
there has been striking evidence of the manner in which
circumstances alter everything. The Zulu War put an end to the
practice of taking the colours of a regiment into battle; the South
African War saw khaki substituted universally for the scarlet livery of
His Majesty; and to have found upon a South African battlefield the
last remnant of the armorial practices of the days of chivalry, one
would have needed, I am afraid, to examine the buttons of the
troopers. Still the scarlet coat exists in the army on parade: the Life
Guards wear the Royal Cross of St. George and the Star of the
Garter, the Scots Greys have the Royal Saltire of St. Andrew, and the
Gordon Highlanders have the Gordon crest of the Duke of Richmond
and Gordon; and there are many other similar instances.
There is yet another point. The band of a regiment is maintained by
the officers of the regiment, and at the present day in the Scottish
regiments the pipers have attached to their pipes banners bearing
the various personal armorial bearings of the officers of the
regiment. So that perhaps one is justified in saying that the use of
armorial bearings in warfare has not yet come to an end. The other
ancient usages of armory exist now as they existed in the earliest
times. So that it is foolish to contend that armory has ceased to
exist, save as an interesting survival of the past. It is a living reality,
more widely in use at the present day than ever before.
Certainly the military side of armory has sunk in importance till it is
now utterly overshadowed by the decorative, but the fact that
armory still exists as the sign and adjunct of hereditary rank utterly
forbids one to assert that armory is dead, and though this side of
armory is also now partly overshadowed by its decorative use,
armory must be admitted to be still alive whilst its laws can still be
altered. When, if ever, rank is finally swept away, and when the
Crown ceases to grant arms, and people cease to use them, then
armory will be dead, and can be treated as the study of a dead
science.
CHAPTER III
THE HERALDS AND OFFICERS OF ARMS
The crown is the Fountain of Honour, having supreme control of
coat-armour. This control in all civilised countries is one of the
appanages of sovereignty, but from an early period much of the
actual control has been delegated to the Heralds and Kings of Arms.
The word Herald is derived from the Anglo-Saxon—here, an army,
and wald, strength or sway—though it has probably come to us from
the German word Herold.
In the last years of the twelfth century there appeared at festal
gatherings persons mostly habited in richly coloured clothing, who
delivered invitations to the guests, and, side by side with the
stewards, superintended the festivities. Many of them were
minstrels, who, after tournaments or battle, extolled the deeds of
the victors. These individuals were known in Germany as Garzune.
Originally every powerful leader had his own herald, and the dual
character of minstrel and messenger led the herald to recount the
deeds of his master, and, as a natural consequence, of his master's
ancestors. In token of their office they wore the coats of arms of the
leaders they served; and the original status of a herald was that of a
non-combatant messenger. When tournaments came into vogue it
was natural that some one should examine the arms of those taking
part, and from this the duties of the herald came to include a
knowledge of coat-armour. As the Sovereign assumed or arrogated
the control of arms, the right to grant arms, and the right of
judgment in disputes concerning arms, it was but the natural result
that the personal heralds of the Sovereign should be required to
have a knowledge of the arms of his principal subjects, and should
obtain something in the nature of a cognisance or control and
jurisdiction over those arms; for doubtless the actions of the
Sovereign would often depend upon the knowledge of his heralds.
The process of development in this country will be more easily
understood when it is remembered that the Marshal or Earl Marshal
was in former times, with the Lord High Constable, the first in
military rank under the King, who usually led his army in person, and
to the Marshal was deputed the ordering and arrangement of the
various bodies of troops, regiments, bands of retainers, &c., which
ordering was at first facilitated and at length entirely determined by
the use of various pictorial ensigns, such as standards, banners,
crests, cognisances, and badges. The due arrangement and
knowledge of these various ensigns became first the necessary study
and then the ordinary duty of these officers of the Marshal, and their
possession of such knowledge, which soon in due course had to be
written down and tabulated, secured to them an important part in
mediæval life. The result was that at an early period we find them
employed in semi-diplomatic missions, such as carrying on
negotiations between contending armies on the field, bearing
declarations of war, challenges from one sovereign to another,
besides arranging the ceremonial not only of battles and
tournaments, but also of coronations, Royal baptisms, marriages,
and funerals.
From the fact that neither King of Arms nor Herald is mentioned as
officiating in the celebrated Scrope and Grosvenor case, of which
very full particulars have come down to us, it is evident that the
control of arms had not passed either in fact or in theory from the
Crown to the officers of arms at that date. Konrad Grünenberg, in
his Wappencodex ("Roll of Arms"), the date of which is 1483, gives a
representation of a helmschau (literally helmet-show), here
reproduced (Fig. 12), which includes the figure of a herald. Long
before that date, however, the position of a herald in England was
well defined, for we find that on January 5, 1420, the King appointed
William Bruges to be Garter King of Arms. It is usually considered in
England that it would be found that in Germany armory reached its
highest point of evolution. Certainly German heraldic art is in
advance of our own, and it is curious to read in the latest and one of
the best of German heraldic books that "from the very earliest times
heraldry was carried to a higher degree of perfection and
thoroughness in England than elsewhere, and that it has maintained
itself at the same level until the present day. In other countries, for
the most part, heralds no longer have any existence but in name."
The initial figure which appears at the commencement of Chapter I.
represents John Smert, Garter King of Arms, and is taken from the
grant of arms issued by him to the Tallow Chandlers' Company of
London, which is dated September 24, 1456.
Long before there was any College of Arms, the Marshal, afterwards
the Earl Marshal, had been appointed. The Earl Marshal is now head
of the College of Arms, and to him has been delegated the whole of
the control both of armory and of the College, with the exception of
that part which the Crown has retained in its own hands. After the
Earl Marshal come the Kings of Arms, the Heralds of Arms, and the
Pursuivants of Arms.
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!

ebookname.com

You might also like