Python Programming 4th Edition Singh A. all chapter instant download
Python Programming 4th Edition Singh A. all chapter instant download
https://ebookgate.com/product/python-programming-for-teens-1st-
edition-kenneth-a-lambert/
ebookgate.com
https://ebookgate.com/product/expert-python-programming-2nd-edition-
jaworski/
ebookgate.com
https://ebookgate.com/product/core-python-programming-2nd-edition-
wesley-chun/
ebookgate.com
https://ebookgate.com/product/programming-python-3rd-ed-edition-mark-
lutz/
ebookgate.com
Ultimate Python Programming 1st Edition Deepali Srivastava
https://ebookgate.com/product/ultimate-python-programming-1st-edition-
deepali-srivastava/
ebookgate.com
https://ebookgate.com/product/black-hat-python-python-programming-for-
hackers-and-pentesters-1st-edition-seitz/
ebookgate.com
https://ebookgate.com/product/practical-maya-programming-with-
python-1st-edition-galanakis/
ebookgate.com
https://ebookgate.com/product/learning-beaglebone-python-programming-
unleash-the-potential-of-beaglebone-using-python-1st-edition-hiam/
ebookgate.com
https://ebookgate.com/product/foundations-of-python-network-
programming-third-edition-brandon-rhodes/
ebookgate.com
Ajit Singh
Python
Programming
4th Edition
Featured With......
ISBN-13 :979-8321458457
Pandas
GUI Programming
Modules & Library
Database Connectivity
101 Python Programs
Copyrighted Material
AKNOWLEDGEMENT
This piece of study of python is an outcome of the encouragement, guidance, help and assistance provided
to us by our colleagues, faculties, Tech-friends and my family members.
As an acknowledgement, I would like to take the opportunity to express my deep sense of gratitude to all
those who played a crucial role in the successful completion of this book, especially to my senior scholars;
this book certainly has been benefited from discussions held with many IT professionals (Ex-students)
over the years it took to write it.
Python reflects on a number of growing trends in software development, putting it at or near the leading
edge of good programming languages. It is a very simple language surrounded by a vast library of add
on modules. It is an open source project, supported by many individuals. It is an object-oriented language,
binding data and processing into class definitions. It is a platform-independent, scripted language, with
complete access to operating systems APIs. It supports integration of complex solutions from pre-built
components. It is a dynamic language, which avoids many of the complexities and overheads of compiled
languages.
Three Faces of a Language. There are three facets to a programming language: how you write it, what it
means, and the additional practical considerations that make a program useful. While many books cover
the syntax and semantics of Python, in this book, the pragmatic considerations are also covered. My core
objective is to build enough language skills with a good object-oriented design so that the students can have
an efficient knowledge about python on windows platform.
Special thanks goes to our respected professor Prof. Dr. Bal Gangadhar Prasad, who is not only my role
model in learning and teaching but, also a source of encouragement who has always pushed me forward to
utilize my skills in a timely manner and have ever obliged for bearing with me from time to time, insisting
me on sticking to my determination all throughout.
I would also like to thank those who provided the odd suggestions via email to me. All feedbacks were
listened to, as you will no doubt see some content influenced by your suggestions.
I hope that the reader likes this book and finds it useful in learning the concepts of python.
Thank You!!
Ajit Singh!!
PREFACE
This book encapsulates rich practical hands-on experience in developing python based applications,
combined with teaching the subject for graduate/post-graduate students. The book is therefore a culmi
nation of putting together what has been both practiced as well as preached, which is the one of the most
compelling differentiators for this book. It can also be used for independent study by anyone interested in
getting a broad introduction to a core useful set of the python language.
This book isfeatured with advanced topics, such as Python Pandas, Database Connectivity, Python GUI
Programming and Python Libraries apartfrom the core concepts like Multithreading, Exception Handling
and Useful Modules. We explained these because they can solve some problems better than standard solutions.
My approach in this book is to regard python as a language that readers will want to use as a primary tool
in many different areas of their programming work - not just for creating programs with graphical content.
Nevertheless, I recognized that visual examples are much more fun to create and work with.
This book is a close-to-complete presentation of the Python language. Whether you are new to program
ming or a professional developer, this book’s goal is to bring you quickly up to speed on the fundamentals of
the core Python language. After reading this book, you will know enough about Python to apply it in what
ever application domains you choose to explore in your career.
In the four years since the first edition of this book was published in late 2019, there have been sub
stantial changes in Python itself. Although I have attempted to retain as much of the prior version of
this text as possible, this new edition reflects many recent changes in the Python language, as well as a
handful of structural changes.
There are no absolute prerequisites to speak of, really. Both true beginners and crusty programming
veterans have used this book successfully. If you are motivated to learn Python, this text will probably
work for you. In general, though, we have found that any exposure to programming or scripting before
this book can be helpful, even if not required for every reader.
Feedback
I have tried to wash out every error in our third edition of this book after being reviewed by lots of bachelor of
Computer Science, but as happens with any programming language - A few difficult to understand bugs shall
remain and of course, typos - and therefore, suggestions from students that may lead to improvement in next
edition in shortcomingfuture are highly appreciated.
Constructive suggestions and criticism always go a long way in enhancing any endeavour. I request all readers
to email me their valuable comments / views /feedback for the betterment of the book at ajit_singh24@ya-
hoo.com, mentioning the title and author name in the subject line. Please report any piracy spotted by you as
well. I would be glad to hear suggestionsfrom you.
Python Programming
4th Edition
Copyrighted Material
Copyright © 2024-25 by Ajit Singh, All Rights Reserved.
No part of this publication may be reproduced, stored in a retrieval system or transmitted, in any
form or by any means — electronic, mechanical, photocopying, recording or otherwise— without
prior written permission from the author, except for the inclusion of brief quotations in a review.
For information about this title or to order other books and/or electronic media, contact the
publisher:
PYTHON
? INSTITUTE
MnM r.to*
PCAP: Programming Essentials in Python
Statement of Achievement
Presented To:
Ajit Singh
Warne
During the Cisco Networking Academy® self-paced course.the student has studied the following Skills:
• the universal concepts of computer programing (i e variables, flow control, data structures, algorrthms, condtional execution loops, functions, etc,)
• developer teds and the runtime environment;
• lire syntax and semantics of the Python language;
• the fundamentals d cbicct oncnlod programing and the way they arc acoprtcd m Python .
• the means by which to rcsdvc typ<cal implementation problems
• the writing of Python programs using standard language infrastructure.
• fundamental programing techniques, best practices, customs and vocabulary, inducing the most common library function in Python 3;
17 Jan 2020
Date
By completing the course. tha student is no* randy Io atisrn.nl rhn quaincaron PCAP-Ceditmri Assoc nte in Python Programing certification, from ths OpnnEDG Python Inshtuls
. rotacad com |mm pythoninstttixe <x g
CONTENTS
Lists
List Literal Values
List Operations
List Comparison Operations
List Statements
List Built-in Functions
List Methods
Stack & queue using list
Copy list
150
Dictionary Comparison Operations
Dictionary Statements
Dictionary Built-in Functions
Dictionary Methods
Iterators
18 Python Pandas 166
Introduction to Pandas
Key features of Pandas
Anaconda Pythons Distribution
Downloading, installing and customizing Anaconda on Windows
Working with Numpy
Working with Series
Working with DataFrame
Working with Panel
Data transferring from CSV files to data frame and vice versa.
Data transferring from Excel files to data frame and vice versa.
Data transferring from SQLite to data frame and vice versa.
19 Python GUI Programming 201
Introduction to TKinter
GUI Components
Label, Button, Entry Box, Textbox, Frame, Dialog, Windows,Radio,
Checkbok
Event & Event Handling
20 Database Connectivity In Python 222
Database
Database Interface
Phythons Database API
Python Database Programming Using MySQL
Python Database Programming Using ORACLE
Handling errors in Database Programming
21 The Python Library 223
Overview of the Python Library
Most Useful Library Sections
22 101 Python Programs 243
Chapter 1
Getting Started with Python
Python is an open source, high-level programming language developed by Guido van Rossum in the late
1980s and presently administered by Python Software Foundation. It came from the ABC language that he
helped create early on in his career.
Python is an interpreted language. This means that every time a program is run, its interpreter runs through
the code and translates the codes into machine-readable byte code.
Python is an object-oriented language that allows users to manage and control data structures or objects to
create and run programs. Everything in Python is, infact,jirst class. All objects, data types, junctions, meth
ods, and classes take equal position in Python.
It is a high-level language. Reading and writing codes in Python is much like reading and writing simple
regular English statements. Python is a powerful language that you can use to create games, write GUIs,
and develop web applications.
History of Python
Python language was developed by Guido van Rossum in the late eighties and early nineties at
the National Research Institute for Mathematics and Computer Science in the Netherlands.
Python is implemented in C, and relies on the extensive, well understood, portable C libraries. It fits seam
lessly with Unix, Linux and POSIX environments. Since these standard C libraries are widely available for
the various MS-Windows variants, and other non-POSIX operating systems, Python runs similarly in all
environments.
Evolution of Python
The development of Python occurred at a time when many other dynamic (and open-source) program
ming languages such as Tel, Perl, and (much later) Ruby were also being actively developed and gaining
popularity.
Version 1 of Python : Python 1.0 was released in January 1994. The major release included a number of
new features and functional programming tools including lambda, filter, map and reduce.
Version 2 of Python: In October 2000, Python 2.0 was released with the new list comprehension feature
and a garbage collection system. The Python Software Foundation has already announced that there
would be no Python 2.8. However, the Foundation will provide support to version 2.7 of the programming
language till 2020.
Version 3 of Python : Python 3.0 was released in December 2008. It came with a several new features
and enhancements, along with a number of deprecated features. The deprecated features and backward
incompatibility make version 3 of Python completely different from earlier versions. So many Python
developers still use Python 2.6 or 2.7 to avail the features deprecated from last major release.
As Python 3 is backward incompatible, the programmers cannot access features like string exceptions, old-
style classes, and implicit relative imports. Also, the developers must be familiar with changes made to
syntax and APIs. They can use a tool called 2to3 to migrate their application from Python 2 to 3 smoothly.
The tool highlights incompatibility and areas of concern through comments and warnings. The comments
help programmers to make changes to the code, and upgrade their existing applications to the latest ver
sion of programming language.
The version 2 and version 3 of Python are completely different from each other. So each programmer must
understand the features of these distinct versions, and compare their functionality based on specific needs
of the project. Also, he needs to check the version of Python that each framework supports. However, each
developer must take advantage of the latest version of Python to avail new features and long-term support.
The difference between
"Python Implementation" vs. "Python distribution" vs. Python
Python itself is a programming language as per the behavior defined by the documentation available on
python.org. Anything that does what that documentation says it's supposed to do would "count" as being
Python....
An implementation of Python is an actual program that provides the behavior defined by the documenta
tion available on python.org. It has various implementations which allow you to run programs written in
it. To give you a better idea, msvc, clang, gcc are implementations of C. Here are some python implementa
tions:
• CPython: this is the default, and what you should be using if you have no idea.
• Jython: implementation in java, allows you to use the java api.
• IronPython: implementation for .net, allows you to use the .net api.
• PyPy: JIT implementation.
A distribution of Python is a bundle that contains an implementation of Python along with a bunch of
libraries or tools or packages. In theory, a distribution of Python could use any implementation, although
all the ones I know of use CPython. The download from python.org could also be considered a distribution
(a minimal distribution that doesn't contain any "extras").
In practice, most people using Python for practical purposes are using CPython (the de facto standard
implementation), so the real choice is among different distributions of that. Among those, you mainly
choose based on what extras you want to come with it. You can choose to use the "bare" distribution from
python.org and then install packages yourself, or if you plan on doing scientific/analytics computing, you
could choose one of the distributions geared towards that (e.g., Anaconda or Canopy).
Features/Advantages of Using Python Language
2. Object Oriented Language - Almost everything is an object in this language. It supports Data hiding,
Multiple inheritance, Interfaces and polymorphism.
3. Runs across different platforms - Python works on Windows, Linux/UNIX, Mac OS X, other operating
systems and small-form devices as well as it also runs on microcontrollers used in appliances, toys, remote
controls, embedded devices, and other similar devices.
4. Highly Structured Language - Statements, functions, classes, modules, and packages enable us to write
large, well structured applications so that to have the feature of readability, locate ability, modifiability.
5. Higher Productive Language - Pythons codes are considerably shorter, simpler, and less verbose than
other high-level programming languages such as Java and C++. In addition, it has well-designed built-in
features and standard library as well as access to third party modules and source libraries. These features
enable programming in Python more efficient.
6. Dynamic Language - It is dynamic language as types are bound to values, not to variables, function and
method lookup is done at runtime, values are inspectable and we can list the methods supported by any
given object.
7. Strongly Typed Language - at runtime rather than compile time. Objects (values) have a type, but vari
ables do not have in this language.
8. Embedding and Extending Language - Python provides a well documented and supported way
(1) to embed the Python interpreter in C/C++ applications and
(2) to extend Python with modules and objects implemented in C/C++.
Cython enables us to generate C code from Python and to "easily" create wrappers for C/C++ functions.
To embed and extend Python with Java, there is Jython.
9. Reasonably High level - It contains high level builtin data types as well as high level control structures.
10. Less Learning Time - Python is relatively easy to learn as compare to other languages. Python is a a
good to first language for learning programming because it uses simple syntax and shorter codes.
Python has varied advantageous features, and programmers prefer this language to other programming
languages because it is easy to learn and code too. But, this language has still not made its place in some
computing arenas that includes Enterprise Development houses. Therefore, this language may not solve
some of the enterprise solutions, and limitations include-
4. Run-time Errors
The Python language is dynamically typed so it has many design restrictions that are reported by some
Python developers. It is even seen that it requires more testing time, and the errors show up when the ap
plications are finally run.
Some Jargon
For folks new to developing software, it might help to understand a few distinctions made above.
Interpreted
Not Interpreted (i.e., Compiled)
Python is a byte-code interpreter. A Python code object is a sequence of bytes that represent various opera
tions and values. The Python interpreter steps through the bytes, performing the operations.
A compiled language (e.g., C, C++, etc.) is translated from source form to executable binary specific to oper
ating system and hardware platform.
Java is similar to Python: its compiled and the Java Virtual Machine is a byte-code interpreter.
Dynamic
Not Dynamic (i.e., Static)
Python is a dynamic language. Variables and functions do not have defined data types. Instead, a variable
is simply a label attached to an object. A function is a callable object with parameters, but no declared result
type. Each object has a strongly-defined permanent class.
There is no sophisticated compile-time type checking. Instead, any type mismatches will be detected at
run-time. Since many types are nearly interchangeable, there isnt a need for a lot of type checking. For ex
amples of interchangeable (polymorphic) types, see Simple Numeric Expressions and Output.
Languages like C, C++ and Java have statically-declared variables and functions.
Scripting
Non-Scripting
The scripting distinction is an operational feature of POSIX-compliant operating systems. Files which
begin with the #!/path/to/interpreter will be used as scripts by the OS. They can be executed from the com
mand-line because the interpreter is named in the first line of the file.
Languages like Java, C and C++ do not have this feature; these files must be compiled before they can be
executed.
Chapter 2
Installing Python
Installing Python in Windows
To install Python, you must first download the installation package of your preferred version from this
link:
https://www.python.org/downloads/
On this page, you will be asked to choose the recent versions for Python 3.11.x/3.12.x which was released
on 8th Feb 2023. Alternatively, if you are looking for a specific release, either Python 2 or 3, you can scroll
down the page to find download links for earlier versions.
python i
About Downloads Documentation Community
Run the downloaded file. This brings up the Python install wizard, which is really easy to use. Just accept
the default settings, wait until the install is finished, and you are done.
Finally, if the installation process is a success, the following window will appear:
£• Python 3.10.5 (64-bit) Setup
See what's new in this release, or find more info about using
Python on Windows.
python
for
windows Close
For Windows programmers, the windows command interpreter uses the last letters of the file name to
associate a file with an interpreter. You can have Windows run the python.exe program whenever you dou
ble-click a .py file. This is done with the Folder Options control panel. The File Types tab allows you to pair
a file type with a program that processes the file.
You can get your python path in the folder where you have installed python. Example - for us it D:\Soft-
wares\Python\
How to Test the Python in Microsoft Windows
The last part, it will display on how to test the result of the python installation in the previous part. It is
actually very simple as it exist in the following steps:
As usual, just execute the Command Prompt.
Following after, type the command below to test whether ‘python’ is available and it is exist in the environ
ment variable of ‘Path’:
C:\Users\Personal>python
Python 3.11.2 (tags/v3.11.2:f377153, Jun 6 2022,16:14:13) [MSC v.1929 64 bit (AMD64)] on Win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Last but not least, just perform another test to make sure. The following test is executing a certain com
mand to check the version of the installed python as follows :
C:\Users\Personal>python -V
Python 3.11.2
C:\Users\Personal>
As it appear in the output of the above command execution, the version is matched. It is python with the
version of‘3.11.2’.
Python Editors
> Vim http://www.vim.org/
> Emacs See http://www.gnu.org/software/emacs/
> SciTE http://www.scintilla.org/SciTE.html.
> MS Windows only
(1) TextPad http://www.textpad.com;
(2) UltraEdit http://www.ultraedit.com/.
> Jed See http://www.jedsoft.org/jed/.
> jEdit Requires a bit of customization for Python See http://jedit.org.
> Geany http://www.geany.org/
Interactive Interpreters:
> python
> ipython
> Idle IDEs
This new version of Python mainly focuses on improving the performance of the language. A few nice features
around exception handling and error display should also improve the development experience.
1. Improved performance
On average, a 25% performance gain compared to Python 3.11 is announced. Some operations are even up to 60%
faster than the latest version. The start-up time is reduced by 10% on average.
The measurements were performed with performance using CPython compiled with GCC under Ubuntu.
The performance gain comes mainly from the specialization of some instructions when the calls to a code are repet
itive. The fact that the code repeats itself without necessarily changing allows the interpreter to analyze the running
code and replace the generic code with type-specific pieces.
Another improvement comes from reducing the number of calls to the system memory in favor of allocating more
space. If these performance gains are always good to take, they do not turn Python into an efficient programming
language.
An increase in memory consumption of around 20% is anticipated following the implementation of these changes on
CPython.
Further performance gains are already planned in versions 3.12 and later.
Special work has been done on error management. It is now possible to add annotations on exceptions.
try:
raise ExceptionGroup("Exception Group", (
TypeErrorf'Type error"),
KeyError("Key error"),
ValueError("Value error"),
except* (ValueError, TypeError) as exc:
exc.add_note("Add more information about the error")
raise exc
The error messages returned by Python are now more precise and include the position of the error on the faulty line
of code. This function is very similar to what other modern languages can offer.
+--------------------------
I Traceback (most recent call last):
I File "test.py", line 5, in test
I assertx < 0
|AAAAAAAAAAAA
4. Improved typing
As we know, Python is a dynamically typed language, which is not always appreciated by developers. The latest
Python updates have already started the integration of an optional type system. This release continues that trend by
adding more types like Self, Literalstring, Required, and NotRequired.
class Foo:
def _init_ (self, x: str):
self.x = x
The standard Python library is not left out and is experiencing some changes.
TOML
First of all, the tomllib module is added to the standard library to parse TOML. This addition follows support for the
pyproject.toml file, added in a previous version of Python.
This library remains limited in terms of functionalities and has only one purpose: file parsing.
import tomllib
with open("pyproject.toml", "rb") as f:
data = tomllib.load(f)
print(data["project"]["name"])
AsyncIO
The asyncio library is also entitled to an update with the addition of Task Group to replace the use of the .gather()
method on asynchronous operations.
import asyncio
async def task 1():
print("Foo")
await asyncio.sleep(5)
StrEnum
The StrEnum makes an appearance. It allows to automatically convert a character string into an Enum.
Path
The Path.glob() method of pathlib now allows you to specify whether you only want to retrieve folders.
6. Miscellaneous deprecation
Finally, this version brings a background cleanup and removes support for many legacy modules: aifc, chunk, msilib,
pipes, telnetlib, audioop, crypt, nis, sndhdr, uu, cgi, imghdr, nntplib, spwd, xdrlib, cgitb, mailcap, ossaudiodev,
sunau...
Some of these modules will not be removed from the standard library until Python 3.13. Others will simply be re
placed by alternative solutions, more modern and better maintained, already present in the standard library.
In conclusion, if this update does not bring anything revolutionary, it continues the Python projects already launched
with regard to the improvement of the performances of CPython, the improvement of the error management and the
addition of solutions for typing requested by part of the community.
Chapter 3
Interacting with Python
Python is a flexible and dynamic language that you can use in different ways. You can use it interactively
when you simply want to test a code or a statement on a line-by-line basis or when youre exploring its
features. You can use it in script mode when you want to interpret an entire file of statements or applica
tion program.
To use Python interactively, you can use either the Command Line window or the IDLE Development
Environment.
> > > prompt. It may not be the most preferred interaction with Python, but it is the simplest way to explore
how Python works.
Running Python
There are three different ways to start Python -
1. Interactive Interpreter
From Windows
Start-> All Programs -> Python 3.11 -> Python 3.11
2. Script from the Command-line
A Python script can be executed at command line by invoking the interpreter on your application, as in the
following -
C: >python script.py
We use commands to tell the computer what to do. When you want Python to do something for you, you
have to instruct it by entering commands that it is familiar with. Python will then translate these com
mands to instructions that your computer or device can understand and execute.
To see how Python works, you can use the print command to print the universal program Hello, World!
Open Pythons command line.
At the >>>prompt, type the following: print(Hello, World!)
Press enter to tell Python that youre done with your command. Very quickly, the command line window
will display Hello, World! on the following line:
Youll get syntax error messages whenever you enter invalid or incomplete statements. In this case, you
typed print with a capital letter which is a big no to a case-sensitive language like Python.
If youre just using Python interactively, you can do away with the print command entirely by just typing
your statement within quotes such as Hello, World!
Getting Help
Python has two closely-related help modes. One is the general help utility, the other is a help function that
provides the documentation on a specific object, module, function or class.
Exiting Python
To exit from Python, you can type any of these commands:
quit()
exit()
Control-Z then press enter
Recently added
The Python Shell window has the following menu items: File, Edit, Shell, Debug, Options, Windows, and
Help.
Python 3.9.0 Shell — □ X
File Edit Shell Debug Options Window Help
Pychon 3.9.0 (cags/v3.9.O:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927
64 bit (AMD64)] on Win32
Type "help", "copyright", "credits" or "license()" for more informati
on .
»> I
Ln: 3 Col: 4
The Shell and Debug menus provide capabilities you would find useful when creating larger programs.
The Shell menu allows you to restart the shell or search the shells log to find the most recent reset.
The Debug Menu has useful menu items for tracing the source file of an exception and highlighting the
erring line. The Debugger option will usher in an interactive debugger window that will allow you to step
through the running program. The Stack Viewer option displays the current Python stack through a new
window.
The Options menu allows you to configure IDLE to suit your Python working preferences.
The windows menu bar varies only slightly with the Shell Window. It doesnt have the Shell and Debug
menu found in the Shell Window but it introduces two new menus: the Run and the Format menu. When
you choose to Run your code on the file window, you can see the output on the Shell Window.
Save Ctrl+S
Save As... Ctrl*Shift*S
Save Copy As... Alt*Shift*S
Close Alt*F4
Exit Ctrl+Q
Click on File and then select New File (alternatively, you may use the keyboard shortcut of Ctrl+N):
You would now see the following “untitled” box, where you can type your Python code:
Random documents with unrelated
content Scribd suggests to you:
La potence, ainsi que l'arbre défendu du paradis terrestre, donne
la mort et la science.
La vérité dans un puits et la vérité dans le vin, signifient la même
chose: il ne faut dire son secret qu'à un homme sobre.
Les bons écrits sont comparables au vin: le bon sens en est la
force; et l'esprit, la saveur.
Le respect pour nous-mêmes, voilà la morale: la déférence pour
les autres, voilà les manières.
Les amoureux s'expriment fort bien quand ils parlent d'échanger
leurs cœurs. La passion enchanteresse de l'amour dénature
effectivement le caractère des deux sexes. Elle donne de l'esprit à la
bergère, de la douceur au berger; elle échange enfin entr'eux le
courage et la timidité.
Quand le malheur est suspendu sur ma tête, je m'écrie: Dieu,
préserve-m'en. Quand il me frappe: Dieu, soit loué.
Le courage et la modestie sont les deux vertus les moins
équivoques, parce que l'hypocrisie ne sauroit les imiter.
Elles ont encore cette propriété, qu'elles s'annoncent en nous par
la même couleur.
Les hommes sont comme les plantes: les unes aiment le soleil, et
les autres l'ombre.
Il y a deux sortes d'écrivains moraux: les uns font de l'homme un
ange et les autres une bête. Ils ont tous tort: l'un argumente du
meilleur, et l'autre du pire des hommes. Le docteur Young les
concilie ainsi: «Nous ne pouvons avoir une trop haute idée de notre
nature, et une trop basse de nous-mêmes.»
Les rois sont plus malheureux que leurs sujets: l'habitude
accoutume au mal-aise, tandis que la fatigue de régner devient
chaque jour plus pénible. Ce qui m'a le plus surpris dans l'histoire,
c'est d'y rencontrer si peu d'abdications. Une douzaine ou deux, tout
au plus, de rois sont descendus volontairement de leur trône: et
encore quelques-uns s'en sont repenti!
Le mensonge est la plus insupportable poltronerie. C'est craindre
les hommes et braver Dieu.
Les franc-penseurs sont généralement ceux qui ne pensent
jamais.
Zoroastre, selon Pline, rit le jour de sa naissance, et Thomas
Morus le jour de sa mort: quel est le plus extraordinaire des deux?
Il y a eu des femmes célèbres dans toutes les sectes
philosophiques; mais rien n'a égalé le mérite des pytagoriciennes: il
falloit se taire et garder le secret.
Solon privoit les pères de leur autorité sur les bâtards, par une
raison très-curieuse: ils avoient été pères pour leur plaisir, ils étoient
récompensés par le plaisir de l'avoir été.
Hucheson, grand mathématicien, damne ou sauve les hommes,
par des équations d'algèbre en plus et en moins. Il falloit que saint
Pierre, selon lui, sût bien les mathématiques; et je ne connois que
saint Mathieu, dans le ciel, qui, en sa qualité de financier put assister
à un pareil compte.
Je demandai à un ermite, en Italie, comment il pouvoit vivre seul,
dans une chaumière élevée sur la cîme d'une montagne, à un mille
de toute habitation; il me répondit aussitôt: La providence est à ma
porte.
Dans le monde, vous êtes sujet aux caprices de chaque
extravagant: dans votre bibliothèque, vous soumettez les hommes
célèbres aux vôtres.
Une bonne comparaison doit être aussi courte et aussi concise
que la déclaration d'amour que fait un roi.
J'ai connu un brave soldat, qui me confioit le secret de son
courage, en ces termes: Dans un combat, au premier feu, je me
figurois être un homme mort; je combattois, tout le long du jour,
dans cette idée, sans appercevoir seulement le danger. Mon illusion
ne cessoit que quand je rentrois dans ma tente: je revenois des
limbes; je vis encore; me disois-je!
J'admire la philosophie de celui qui pardonne; mais j'aime le
caractère de celui qui sent.
Au commencement du seizième siècle, un prêtre ayant trouvé
dans un auteur grec, ce passage: ονους εστιν αυλος, l'ame est
immatérielle, et ayant vu dans son lexicon que αυλος signifioit flûte,
il composa, dans un exercice académique, quinze argumens, tout au
moins, pour prouver que l'ame étoit un sifflet.
Les juifs envoyèrent des ambassadeurs à Cromwel, pour savoir
s'il n'étoit pas le vrai messie.
Le pape Jules II lisoit la Bible quand on lui apprit la défaite de
son armée par les Français: il la jeta par terre pour témoigner à Dieu
son ressentiment.
L'ancienne Rome se rendit la maîtresse, (ce mot est pire que
celui de maître) de l'univers, sous ses consuls, par la même méthode
que la nouvelle a continué d'employer sous ses pontifes. Le bien de
la république étoit le prétexte de Rome ancienne; le bien de l'église
est celui de la moderne. D'après ce principe, auquel les autres sont
subordonnés, tous les vices, l'oppression et la fausseté, quand ils
favorisent la domination, deviennent ou des vertus publiques, ou des
fraudes pieuses.
Par une loi des canons, si l'on accuse un cardinal de fornication, il
faut produire soixante-dix témoins: à ce compte, il doit caresser une
fille en plein marché, pour être convaincu.
Combien le système de l'amour platonique seroit beau, s'il
pouvoit se réaliser! que ses extases seroient pures et séraphiques!
deux cœurs fidèles, doucement agités dans la même sphère
d'attraction, le même sistole, le même diastole, sujets au même flux
et reflux, et se rapprochant toujours plus près l'un de l'autre, par la
compulsion la plus agréablement insensible, comme les asymptotes
d'une hyperbole, sans jamais coïncider ensemble et rencontrer le
point de contact!
Rien ne rappelle si puissamment notre ame que l'infortune. Les
fibres tendues se relâchent; alors l'ame égarée se retire en elle-
même, s'assied toute pensive, et admet en silence la salubrité des
réflexions. Si nous avons un ami, nous pensons aussitôt à lui; si
nous avons un bienfaiteur, ses bontés pressent alors sur notre cœur.
Grand Dieu! n'est-ce pas par cette raison, que ceux qui t'ont oublié
dans leur prospérité, reviennent à toi dans leurs chagrins? quand ils
abattent nos esprits affligés, à qui pouvons-nous plus sûrement
recourir qu'à toi, qui connois nos besoins, qui tiens en dépôt nos
larmes dans ton sein, qui vois nos moindres pensées, et qui entends
chaque soupir mélancolique qui échappe à notre découragement.
Vers le milieu du treizième siècle, et sous le pontificat de
Grégoire IX, il arriva un singulier événement. Le comte de Gleichen
fut fait prisonnier dans un combat contre les Sarrasins, et condamné
à l'esclavage. Comme il fut employé aux travaux des jardins du
sérail, la fille du Sultan le remarqua. Elle jugea qu'il étoit homme de
qualité, conçut de l'amour pour lui, et lui offrit de favoriser son
évasion s'il vouloit l'épouser. Il lui fit répondre qu'il étoit marié; ce
qui ne donna pas le moindre scrupule à la Princesse accoutumée au
rit de la pluralité des femmes. Ils furent bientôt d'accord, cinglèrent
et abordèrent à Venise. Le comte alla à Rome, et raconta à Grégoire
IX chaque particularité de son histoire. Le Pape, sur la promesse
qu'il lui fit de convertir la Sarrasine, lui donna des dispenses pour
garder ses deux femmes.
La première fut si transportée de joie à l'arrivée de son mari sous
quelque condition qu'il lui fût rendu, qu'elle acquiesça à tout, et
témoigna à sa bienfaitrice l'excès de sa reconnoissance. L'histoire
nous apprend que la Sarrasine n'eut point d'enfans, et qu'elle aima
d'amour maternel ceux de sa rivale. Quel dommage qu'elle ne
donnât pas le jour à un être qui lui ressemblât!
On montre, à Gleichen, le lit où ces trois rares individus
dormoient ensemble. Ils furent enterrés dans le même tombeau
chez les bénédictins de Pétersberg; et le comte qui survécut à ses
deux femmes, ordonna qu'on mît sur le sépulcre, qui fut ensuite le
sien, cette épitaphe qu'il avoit composée.
«Ci gissent deux femmes rivales, qui s'aimèrent comme des
sœurs, et qui m'aimèrent également. L'une abandonna Mahomet
pour suivre son époux, et l'autre courut se jeter dans les bras de la
rivale qui le lui rendoit. Unis par les liens de l'amour et du mariage,
nous n'avions qu'un lit nuptial pendant notre vie; et la même pierre
nous couvre après notre mort.»
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
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.
ebookgate.com