Expert Python Programming 2nd Edition Michal Jaworski Tarek Ziadé instant download
Expert Python Programming 2nd Edition Michal Jaworski Tarek Ziadé instant download
https://ebookmeta.com/product/expert-python-programming-2nd-
edition-michal-jaworski-tarek-ziade/
Michał Jaworski
Tarek Ziadé
BIRMINGHAM - MUMBAI
Expert Python Programming
Second Edition
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the authors, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78588-685-0
www.packtpub.com
Credits
Authors Proofreader
Michał Jaworski Safis Editing
Tarek Ziadé
Indexer
Reviewer Rekha Nair
Facundo Batista
Graphics
Commissioning Editor Jason Monteiro
Kunal Parikh
Production Coordinator
Acquisition Editor Aparna Bhagat
Meeta Rajani
Cover Work
Technical Editor Aparna Bhagat
Pankaj Kadam
Copy Editor
Laxmi Subramanian
About the Authors
Tarek has also created Afpy, the French Python User Group, and has written two
books on Python in French. He has delivered numerous talks and tutorials in French
at international events such as Solutions Linux, PyCon, OSCON, and EuroPython.
About the Reviewer
He delivers talks in the main Python conferences in Argentina and other countries
(The United States and Europe). In general, he has strong distributed collaborative
experience from being involved in FLOSS development and working with people
around the globe for more than 10 years.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on
Packt books and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
Table of Contents
Preface xi
Chapter 1: Current Status of Python 1
Where are we now and where we are going? 2
Why and how does Python change? 2
Getting up to date with changes – PEP documents 3
Python 3 adoption at the time of writing this book 4
The main differences between Python 3 and Python 2 5
Why should I care? 5
The main syntax differences and common pitfalls 5
Syntax changes 6
Changes in the standard library 7
Changes in datatypes and collections 8
The popular tools and techniques used for maintaining cross-version
compatibility 8
Not only CPython 12
Why should I care? 13
Stackless Python 13
Jython 14
IronPython 14
PyPy 15
Modern approaches to Python development 16
Application-level isolation of Python environments 17
Why isolation? 19
Popular solutions 21
virtualenv 21
venv 23
buildout 24
Which one to choose? 24
[i]
Table of Contents
[ ii ]
Table of Contents
super pitfalls 87
Mixing super and explicit class calls 87
Heterogeneous arguments 89
Best practices 90
Advanced attribute access patterns 91
Descriptors 92
Real-life example – lazily evaluated attributes 95
Properties 98
Slots 101
Metaprogramming 102
Decorators – a method of metaprogramming 103
Class decorators 103
Using the __new__() method to override instance creation process 105
Metaclasses 108
The general syntax 109
New Python 3 syntax for metaclasses 112
Metaclass usage 115
Metaclass pitfalls 115
Some tips on code generation 116
exec, eval, and compile 117
Abstract Syntax Tree 118
Projects using code generation patterns 120
Summary 123
Chapter 4: Choosing Good Names 125
PEP 8 and naming best practices 125
Why and when to follow PEP 8? 126
Beyond PEP 8 – team-specific style guidelines 126
Naming styles 127
Variables 127
Constants 128
Naming and usage 129
Public and private variables 130
Functions and methods 131
The private controversy 132
Special methods 134
Arguments 134
Properties 134
Classes 135
Modules and packages 135
The naming guide 136
Using the has or is prefix for Boolean elements 136
Using plurals for variables that are collections 136
Using explicit names for dictionaries 136
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Table of Contents
Cython 248
Cython as a source to source compiler 248
Cython as a language 250
Challenges 253
Additional complexity 253
Debugging 254
Interfacing with dynamic libraries without extensions 255
ctypes 255
Loading libraries 255
Calling C functions using ctypes 257
Passing Python functions as C callbacks 258
CFFI 262
Summary 263
Chapter 8: Managing Code 265
Version control systems 265
Centralized systems 266
Distributed systems 268
Distributed strategies 270
Centralized or distributed? 271
Use Git if you can 271
Git flow and GitHub flow 272
Continuous development processes 276
Continuous integration 277
Testing every commit 278
Merge testing through CI 279
Matrix testing 280
Continuous delivery 280
Continuous deployment 281
Popular tools for continuous integration 282
Jenkins 282
Buildbot 286
Travis CI 288
GitLab CI 290
Choosing the right tool and common pitfalls 290
Problem 1 – too complex build strategies 291
Problem 2 – too long building time 291
Problem 3 – external job definitions 292
Problem 4 – lack of isolation 293
Summary 294
Chapter 9: Documenting Your Project 295
The seven rules of technical writing 295
Write in two steps 296
Target the readership 297
[ vi ]
Table of Contents
[ vii ]
Table of Contents
[ viii ]
Another Random Scribd Document
with Unrelated Content
Personality adds to individuality the element of intelligence, and
consequently of self-consciousness.
2. An object.
Applying this idea to the subject in question, every one can see at
a glance that a faculty cannot be predicated of the Infinite without
falling into pantheism.
Every one who has read Hegel will have observed that his idea of
the Infinite coincides perfectly with the above. For he starts from a
minimum of reality, the Being, Idea, which, through a necessary
interior movement, becomes matter, organism, animality,
intelligence, etc.
It would not do for Unitarians to say that the argument does not
apply to their system, since they admit a substance already existing
and perfect as to being, only endowed with faculties. For, in the
supposition, they would admit a finite, not an infinite being.
Even the pebbles, from which the sun had not yet kissed away a
single dew-drop, were sparkling like jewels as Dick approached
them on his way to the little rustic gate under the evergreen arch.
He stood leaning over it a long time, looking down the cool,
shadowy lane, his heart joining in the joyous morning hymn of
nature, for the first time heard.
"For shame, Trot!" said Will, "that's as bad as asking; and you can't
go to the store either; you'll get wet, the grass is all wet. 'Tan't no
good for girls; you stay home."
Whereupon Trot rubbed her brown little fists in her eyes, and loudly
bewailed her misery in being only a girl, showing also that she had
a will of her own that by no means acknowledged this big boy as
its lord and master. Dick attempted to show him that whereas Trot's
dress was already a finger deep with wet from the long grass
through which she had been tramping all the morning so far, it
couldn't make much difference if it got a little wetter. But Will was
firm, and Trot inappeasable, until, much to our hero's relief, the
noise brought out Rose, who was greatly ashamed of Trot for
making "such a time before the strange gentleman," and very
firmly decided for Will. In some magic way she sent the boy portion
unencumbered by any of the weaker sex, on their way rejoicing,
found something for the girls to do, and took Trot's hand so
resolutely that not a sob was ventured by that small maiden, so
that there was again peace in the land.
What they did all day in the woods, how many brooks they
crossed, who fell in and was fished out with much laughter; how
little Trot got in everybody's way, and ate the others' berries as fast
as they were picked; how the children met other children on the
road; how often all parties rested, and teased each other, and
compared the quantity each had picked; and whether Dick, who
had soon got over his awkwardness, put his berries into Clara's pail
or into Rose's basket, I am not able to relate. I only know they
returned at evening very noisy and very tired; and that Rose had a
larger stock than any other one of the whole party; and that as she
took off her broad-brimmed straw hat, and pushed back the moist
curls from her face, this young lady did not go up at once to wash
off the purple berry stains from her hands, and to put on the pretty
blue muslin with its tiny bit of lace around the neck, but lingered to
hear the children, each interrupting the other, until they were
nearly all talking at once, tell Mr. and Mrs. Stoffs and Mrs. Alaine
the day's adventures. Dick, too, had somewhat to relate, and
glanced at Rose while he told it, although it was only what the
children had told twice over already, how Mr. Dick—it had come to
that with the children—didn't know a turkey from a goose, and had
called things by their wrong names all day; whereat Rose laughed
with the rest, and then ran up to bathe her glowing cheeks in time
to help get tea.
When she came down, she found the children in the same eager
excitement, following the two women from kitchen to cellar, from
the closet to the table, still telling about the big snake they were
sure they had seen run across the path just before them, and the
rabbits, and what Minnie had said, and Will had done, and Charley
had thought; to all which the listeners gave an attentive ear,
laughing when there was need, and surprised at the proper
moment. At tea, the day in the woods continued to furnish food for
animated discussion, and neither Rose nor Dick looked as if the
subject were a tiresome one.
"And how did my little Trot get along?" asked Uncle Carl; but Trot,
who was tired, and cross, and impatient for her piece of cake,
made no answer.
"Trot tumbled into the water," said Will; "she always tumbles in."
"I see that Mr. Dick is very good to you," said Mrs. Stoffs, with a
kind smile toward our hero, who colored and looked his delight.
"I don't think we can get along without Mr. Dick any more, can
we?"
The children declared they could not, and Dick was as pleased as if
he had just taken a degree; but Rose said nothing about the
matter.
Well, that was a merry, merry week; there were so many things
needed, and such long walks were required through the woods,
and over the hills, and even down to the beach, in order to procure
them, while every errand took all day to perform, that Dick learned
to walk on the soft grass without stumbling; even to loiter slowly
along by Rose's side, not often looking to see where he placed his
feet; and the children were such good tutors that he learned the
names of the birds and animals and insects that came in his way,
and knew where there had been the best cherries in the spring,
where there would be the best place for nutting in the fall, and
when the grapes would be ripe, "If only he could be here!"
It was a very quiet evening that followed the last tea at Carlton.
The children were more silent than usual; even Trot was not proof
against the indescribable feeling that settles over a group from
which one is about to take his departure. She climbed into Dick's
lap, and—an uncommon thing with that restless maiden—did not
offer to leave her position all those long twilight hours. When Miss
Brandon rode by—as I forgot to state she did at twilight every
evening—her beautiful pony, her long dress, her hat with its
drooping feather, her veil fluttering in the evening breeze, her buff
gauntlets, and her silver-handled riding-whip—things which had set
the whole flock in commotion before—were hardly commented
upon. When Mr. Irving, so tall and princely, left her side for a
moment, and, coming close to the gate, called after Will, it was
found Rose had forgotten the usual bouquet of flowers for the
ladies, and had to beg the gentleman to wait. Rose felt very guilty;
but Dick endeavored to console her by saying that, without doubt,
Mr. Irving was glad to have a little more time with such a beautiful
young lady as Miss Brandon; and then fell to praising Miss Mary
vehemently—how beautiful she was, how gracious and pleasant to
all, and yet always remembering she was a grand young lady. Rose
thought it very easy to be good and pleasant when people are rich
and beautiful; and then Dick tried to comfort her again, and
perhaps with better success than before; for her only answer was a
silent act of contrition for the envious thought that had flitted
across her mind. Then, still in silence, she cut the flowers that she
could hardly more than guess at in the gathering twilight. Dick was
silent, too; and yet there was a great deal he would like to have
said, even though he little suspected that all he had so far made
clear to her was that Miss Brandon was to him like an angel in a
picture, or a heroine in some old romance, and that, beside her
silent act of contrition, poor little Rose's heart had given one great
throb, and had then made an act of resignation beside. But Dick
found voice to ask for a good-by flower, which Rose gave; and it
may be there were spoken then a few words of more solemn
meaning, such as will come when two people, young and fresh,
find their skies suddenly glowing above them, and their hearts full
of grateful praise to God, who has made life so sweet. And it may
be that little Rose, who said her prayers so regularly for all sinners
and for all who are tempted, said a few broken, bashful words,
exhorting Dick to goodness even in the midst of the "snares of the
great city," and that he eagerly caught the words as they fell,
promised her never to forget them, and inwardly made a quick cry
for God's grace to let him die then rather than do aught to offend
him who had showered such blessings upon him. It may be, too,
that Rose—the simple-hearted maiden—was sure he would never
break the promise, and that their good-by there was a request and
a promise each to pray for the other. But if so, it was not said in
long paragraphs, with flowing periods; for Rose was too
conscientious to detain Mr. Irving a moment longer than needful.
The next morning there was a hurried breakfast, after which they
all went to the little yellow station-house to see him off, and waved
their hats and handkerchiefs until the train was out of sight. A little
longer, and they had returned in a rambling procession home, each
with some remembrance of him to tell the other, while he was in
the city at work once more, but as a different Dick Heremore from
the one who had said goodby, not without emotion, to his slovenly
landlady.
Chapter V.
When Christmas came around again, and made the first break in
the routine of his life after his ever-memorable visit to the country,
Dick, now no longer a follower at a distance of that Sunday
morning crowd, but a devout and well-instructed Catholic, to whom
all the glory and grandeur of the Christmas lights and flowers, the
music and the bells, were no longer mysteries; after hearing the
grand high mass—not the only one he had heard that day—turned
down Fourteenth street, according to the custom of many years, in
order that he might pass the Brandons' house, which had ever held
a charm for him, since on its broad steps he had first seen the
beauty and loveliness of charity. But he was not thinking just then
of Miss Brandon, nor of his newsboy days, nor yet of the fast
approaching hour when he should present himself at Carl Stoffs's
table, in a quarter of the city very different from this, where he was
to eat his piece of Christmas turkey. His thoughts, I am afraid, will
seem wild ones; but he was young, it was Christmas-day, he had
just come from that glorious mass, and the world seemed so small
and easy to conquer to one who had heard the "glad tidings," so
that he may be forgiven for dreaming, in a less prosaic and
unspiritual manner than I can tell you, of a time when he would
eat his Christmas dinner neither at a boarding-house nor at another
man's board, but would carve his own Christmas turkey, at his own
table. Of whatever he was thinking, he did not fail to notice the
house, and to glance upward when he came to the stoop where he
—was it really he, that rough, shaggy, ragged little newsboy,
ignorant and dirty?—where he had, for the first time in his hard
young life, heard a voice address him kindly; and his glance
changed to a steady gaze of surprise when his eye caught a name
on the door-plate that was not Brandon. He looked at the number
—that was all right, but the old name was gone. He was perplexed,
and walked absently backward and forward for several moments.
"Then Mr. Stoffs was right," he said, "and he" (meaning Mr.
Brandon) "has had to come down a peg or two, or he would not
have given up his house at this season. I wonder where they have
gone now."
But when he met Mr. and Mrs. Stoffs, almost the first words he said
were,
"Is it any difficulty made them leave their old house?" asked Dick.
"Oh! I forgot that was after you left; it was quite an excitement.
The horses ran away one night—those same stylish bays of which
she was so proud—when she and her daughter were returning from
some party, and she was dead before morning."
"And Miss Brandon?" Dick could hardly ask, his terror of the answer
was so great.
"Miss Brandon is not that kind," said Dick hastily, vexed by the
contemptuous tone of his friend's remark. "And I don't believe fine
ladies are any more—more—fussy than others."
"I suppose you know them well enough to be a certain judge," said
Carl, who seemed in a very ugly humor.
"Of course I don't know one in the world," answered Dick, with
considerable animation and a deeper color in his face. "But I can't
see the good of always running down people, just because they
happen to be richer than ourselves."
"Hush! now," interposed Mrs. Stoffs, as her husband was about
answering, "or no dinner shall you have this day. I will not let you
two quarrel."
"Yes. His wife she died, and it was found he had used all her
money and had lost it, as he had his own; there was a failure and
everything was sold out, and so—there's an end of him."
"I don't know. Who asks what has become of a one-time rich man
after the bubble has burst?"
"I think I heard he wanted some situation to start life again," said
Mrs. Stoffs. "Poor man!"
Mrs. Stoffs was right. Mr. Brandon had tried to start again; but he
had been a hard man in his days of prosperity, and an unfaithful
man, or he would not be as he was now; and so, many who
heartily pitied him and his family for their fall, and who would
willingly have given them assistance out of their own pockets, did
not feel justified in giving him a position that could be better filled
by some man in whom they could trust. Thus among all his rich
friends, not one of whom felt unkindly toward him, there was none
to push him a plank with which to save himself from drowning.
Dick had learned all that his hosts could tell, and knowing well how
fearfully rapid is a man's fall when once he is over the precipice of
failure, his heart was heavier than it had ever been for troubles of
his own. He sought to sustain his part in the conversation, feeling
that a silent guest seems selfish and ungrateful, and tried to laugh
as heartily at his friend's jokes as ever; but it was not without an
effort, and his friends were keen and saw that he was troubled.
"I do not like it," Carl grunted in his deepest tones, that Christmas
night after Dick had gone and the children were asleep; "I do not
like it."
"You must not think too hardly of him," answered Mrs. Stoffs, who,
with that sort of perception women obtain when they become
wives, knew her husband referred to Dick's troubled manner, the
anxious way in which he had asked about Miss Brandon, and his
hot resenting of Carl's careless words. "You are too hard on him,"
said Mrs. Stoffs, not because she did not equally dislike it all, but
because there would be no conversation between them if old
married folks were always to agree.
"Fine ladies, indeed!" muttered Mr. Stoffs, puffing away harder than
ever. "Miss Brandon—what for should he care if Miss Brandon was
hurt, more than for any other lady?"
"She is poor enough now," said Mrs. Stoffs musingly. "It would not
be so strange now;" and under her breath she sighed, "Poor Rose!"
"She is not above him now that they are poor," answered his wife.
"It isn't the money that made the difference," said Carl rather
impatiently, "it's the habits that money gives. That's what is the
matter. Miss Brandon may not be half worthy of him, and yet he
would be mad to think of her; it is misery when people marry out
of their rank, misery to both."
"That only makes the matter worse; he knows not her ways. She
has a language that is not his; if they did not care, they could go
their own ways, and seek their own. I think Heremore is a great
fool; I do!"
"I don't believe he has a thought of such a thing," said Mrs. Stoffs;
but there was a manifest question in her voice.
"If he has, he'll rue the day he thought of it first," said her
husband emphatically; and there the conversation ended; but when
Mrs. Stoffs wrote again to Mrs. Alaine, which she did not do for
some time—for to write a letter was an event in the honest
woman's life—she thought proper to give her sister a hint of that
which they had observed; and Mrs. Alaine, in her turn, thought
proper to convey the hint, in the form of information, to Rose, who,
however, answered readily,
"Because Miss Brandon is not in the same class of life that he is,
dear."
"I am sure Mr. Heremore is better off than her father is now,"
urged Rose; "for he has a regular salary, and Mr. Brandon has
nothing left, and nobody will give him any place."
"No doubt, my child; but it is not money that makes the difference.
Miss Brandon has her ideas of life now just as she had them when
she was rich; and Mr. Heremore is what he is, and would not be
different if he were suddenly made a millionaire."
While Mr. and Mrs. Stoffs were thus disturbed about him, Dick,
unconscious of any cause he had given for their disquietude, was
walking slowly and thoughtfully home. "Where was that little Mary
with her fair hair and gentle smile this cold Christmas night?" was
the question he kept putting to himself. It was a clear, bright night,
with the moon shining on the pavements and the frozen earth, not
at all such a night as that during which he had slept by her father's
steps, and there was no fear that her fair head was shelterless; but
still it was very sad to think of her, whose Christmas days had been
such pleasant ones, in mourning for her mother, and perhaps in
troubles such as those which men hear, but shudder to see,
clouding the girlish youth that is so short, and should be so sunny.
"With God's help I'll find them out before to-morrow night if they
are in this city," said Dick to himself, and then walked on more
rapidly.
And he kept his word, though not without much trouble; and within
twenty-four hours he stood in front of the wretched boarding-house
to which poverty and sickness had already reduced the family that,
a few months before, had never dreamed of the meaning of want.
But though he had found them out and stood before their door,
Dick had done and could do nothing to lessen their trouble. Mr.
Brandon had not seemed more unapproachable when, a rich man,
he scowled and said hard words to the ill-dressed errand-boy—than
he now did to the simple clerk, though Dick himself was richer now
than was the once rich merchant. Miss Brandon was, in his eyes,
now no less a lady, belonging to a sphere far above him, than she
had been when, in all the glory of wealth, youth, and beauty, he
had seen her ride down to the Stoffs's cottage to buy flowers for
her hair. It seemed to him greater presumption for him to think of
approaching her now than it would have been then, so he passed
and repassed her door, grieved for her trouble, but more grieved, if
possible, that he, with his youth and strength, should be powerless
to give her one grain of comfort. How often and often, as he had
watched her—she all unconscious of him and his grateful reverence
—in her days of prosperity, had he dreamed of her as like some
damsel of olden romance in sore distress, and thought that never
had knight rushed more joyously or more potently to the rescue
than he would to hers. Now his dream had come to pass—she was
a damsel in sore distress; but where was his prancing steed, his
burnished armor, his ready lance? Then, as he smiled in
remembrance of his boyish fancy, he suddenly thought of Mr.
Irving, the gentleman—just a boy's ideal of a gallant knight—whom
he had seen so often with Miss Brandon in the country. He
recollected well the manly bearing of that "perfect gentleman,"
whom he and Rose had looked upon as a veritable Sir Launcelot;
he had seen many an act of "gentle courtesy" shown in a grave,
tender way, to the fair lady by whose side he always rode; and
where was he now that that fair lady needed her knight as never
before?
But all hope of seeing Mr. Irving faded the first thing the next day;
for Dick's questions brought the unwelcome information that he
had left home in October for two years' travel in Europe, and Dick,
of course, could not presume to write to him.
Porter's Human Intellect.
[Footnote 272]
The professor's book is a hard, book for us to read, and still harder
for us to understand. Its mechanical aspect, with three or four
different sizes of type on the same page, is repulsive to us, and
prejudices us against it. It is not absolutely dull, but it is rather
heavy, and it requires resolution to read it. It has nothing attractive
or enlivening, and it deals so much with particulars and details that
it is difficult for the reader to carry what he reads along in his
memory. Even when we have in our minds what the author actually
says, it is not easy to understand it, or determine which of several
possible meanings he adopts. Not that his language, though seldom
exact or precise, and disfigured occasionally by needless
barbarisms, and a terminology which we hope is not yet in good
usage, is not clear enough for any one accustomed to philosophical
studies, nor is it that his sentences are involved and hard to be
construed, or that his statements, taken as isolated statements, are
not intelligible; but it is hard to determine their meaning and value
from his point of view, and in relation to his system as a whole. His
book is composed of particulars, of minute and not seldom
commonplace observations, without any perceptible scientific
reduction to the principle which generates, co-ordinates, and
explains them.
It is but fair to the professor to say, in the outset, that his book
belongs to a class of books which we seldom read and heartily
detest. It is not a work of philosophy, or an attempt even to give
us a science of things in their principles and causes, their progress
and destiny, but merely a Wissenschaftslehre, or science of
knowing. Its problem is not what is or what exists; but what is
knowing, how do I know, and how do I know that I know? With all
deference to the Fichteans, we venture to assert that there is and
can be no science of knowing separate from the science of things,
distinct from and independent of the subject knowing. We know,
says all that, we know that we know, says. He who knows, knows
that he knows; and if one were to doubt that knowing is knowing,
we must let him doubt, for we have only knowing with which to
prove that knowing is knowing.
The professor finds the soul's faculty of observing the facts of the
internal world in consciousness, which he defines to be "the power
by which the soul knows its own acts and states." But
consciousness is not a power or faculty, but an act of knowing, and
is simply the recognition of the soul by the soul herself as the
subject acting. We perceive always, and all that is before us within
the range of our percipient powers; but we do not always
distinguish and note each object perceived, or recognize the fact
that it is we who are the subject perceiving. The fact of
consciousness is precisely in the simple perception being so
intensified and prolonged that the soul not only apprehends the
object, but recognizes itself as the subject apprehending it. It is
not, as the professor maintains at great length in Part I., a
presentative power; for it is always a reflex act, and demands
something of memory. But the recognition by the soul in her acts
as the subject acting is something very different from the soul
observing and analyzing in herself her own powers and faculties.
The soul never knows herself in herself; she only recognizes herself
under the relation of subject in her acts. Recognizing herself only
as subject, she can never cognize herself as object, and stand, as it
were, face to face with herself. She is never her own object in the
act of knowing; for she is all on the side of the subject. She cannot
be on one side subject, and on the other object. Only God can be
his own object; and his contemplating of himself as object,
theologians show us, is the Eternal Generation of the Son, or the
Word. Man, St. Thomas tells us, is not intelligible in himself; for he
is not intelligens in himself. If the soul could know herself in
herself, she could be her own object; if her own object, she would
suffice for herself; then she would be real, necessary, self-existent,
independent being; that is to say, the soul would be God.
We deny not that the soul can know herself as manifested in her
acts, but that she can know herself in herself, and be the object of
her own thought. I can not look into my own eyes, yet I can see
my face as reflected in the glass. So the soul knows herself, and
her powers and faculties; but only as reflected from, or mirrored in,
the objects in conjunction with which she acts. Hence the powers
and faculties are not learned by any observation of the soul herself,
but from the object. The soul is a unit, and acts always as a unit;
but, though acting always in her unity, she can act in different
directions, and in relation to different objects, and it is in this fact
that originates the distinction of powers and faculties. The
distinction is not in the soul herself, for she is a unit, but in the
object, and hence the schoolmen teach us that it is the object that
determines the faculty.
But even granting that there is the class of facts alleged, and that
we have the power to observe and analyze them, as, in the
language of Cousin, "they pass over the field of consciousness," we
cannot by induction attain to their principle and causes; for
induction itself, without the first principles of all science, not
supplied by it, can give us only a classification, generalization, an
hypothesis, or an abstract theory, void of all reality. The universal
cannot be concluded, by way of induction, from particulars, any
more than particulars can be concluded, by way of deduction, from
the universal. Till validated in the prima philosophia, or referred
to the first principles, without which the soul can neither act nor
exist, the classifications and generalizations attained to by induction
are only facts, only particulars, from which no general conclusion
can be drawn. Science is knowledge indeed; but the term is
generally used in English to express the reduction of facts and
particulars to their principles and causes. But in all the secondary
sciences the principles and causes are themselves only facts, till
carried up to the first principles and causes of all the real and all
the knowable. Not without reason, then, has theology been called
the queen of the sciences, nor without warrant that men, who do
not hold that all change is progress, maintain that the
displacement, in modern times, of this queen from her throne has
had a deleterious effect on science, and tended to dissipate and
enfeeble the human mind itself. We have no philosophers nowadays
of the nerve of Plato and Aristotle, the great Christian fathers, or
the mediaeval doctors, none of whom ever dreamed of separating
theology and philosophy. Even the men of the sixteenth and
seventeenth centuries had a grasp of thought, a robust vigor of
mind, and a philosophic insight into the truth of things and their
higher relations that you look in vain for in the philosophers of the
eighteenth century and of our own. But this by the way. When
things are at the worst, they sometimes mend.