Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50f8169

Browse files
committed
From a suggestion on c.l.py: modernize the introduction to the tutorial.
* Remove talk of shell scripting, replacing it by some more current examples * Mention C++ and Java as well as C Raymond H., please feel free to rewrite or revert as you see fit. If the changes are OK, they could be backported to the 2.4-maint branch.
1 parent af57fa1 commit 50f8169

1 file changed

Lines changed: 40 additions & 32 deletions

File tree

Doc/tut/tut.tex

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -72,35 +72,42 @@ \chapter*{Front Matter\label{front}}
7272

7373
\chapter{Whetting Your Appetite \label{intro}}
7474

75-
If you ever wrote a large shell script, you probably know this
76-
feeling: you'd love to add yet another feature, but it's already so
77-
slow, and so big, and so complicated; or the feature involves a system
78-
call or other function that is only accessible from C\ldots\ Usually
79-
the problem at hand isn't serious enough to warrant rewriting the
80-
script in C; perhaps the problem requires variable-length strings or
81-
other data types (like sorted lists of file names) that are easy in
82-
the shell but lots of work to implement in C, or perhaps you're not
83-
sufficiently familiar with C.
84-
85-
Another situation: perhaps you have to work with several C libraries,
86-
and the usual C write/compile/test/re-compile cycle is too slow. You
87-
need to develop software more quickly. Possibly you've
88-
written a program that could use an extension language, and you don't
89-
want to design a language, write and debug an interpreter for it, then
90-
tie it into your application.
91-
92-
In such cases, Python may be just the language for you. Python is
93-
simple to use, but it is a real programming language, offering much
94-
more structure and support for large programs than the shell has. On
95-
the other hand, it also offers much more error checking than C, and,
96-
being a \emph{very-high-level language}, it has high-level data types
97-
built in, such as flexible arrays and dictionaries that would cost you
98-
days to implement efficiently in C. Because of its more general data
99-
types Python is applicable to a much larger problem domain than
100-
\emph{Awk} or even \emph{Perl}, yet many things are at least as easy
101-
in Python as in those languages.
102-
103-
Python allows you to split your program in modules that can be
75+
If you do much work on computers, eventually you find that there's
76+
some task you'd like to automate. For example, you may wish to
77+
perform a search-and-replace over a large number of text files, or
78+
rename and rearrange a bunch of photo files in a complicated way.
79+
Perhaps you'd like to write a small custom database, or a specialized
80+
GUI application, or a simple game.
81+
82+
If you're a professional software developer, you may have to work with
83+
several C/\Cpp/Java libraries but find the usual
84+
write/compile/test/re-compile cycle is too slow. Perhaps you're
85+
writing a test suite for such a library and find writing the testing
86+
code a tedious task. Or maybe you've written a program that could use
87+
an extension language, and you don't want to design and implement a
88+
whole new language for your application.
89+
90+
Python is just the language for you.
91+
92+
You could write a {\UNIX} shell script or Windows batch files for some
93+
of these tasks, but shell scripts are best at moving around files and
94+
changing text data, not well-suited for GUI applications or games.
95+
You could write a C/{\Cpp}/Java program, but it can take a lot of
96+
development time to get even a first-draft program. Python is simpler
97+
to use, available on Windows, MacOS X, and {\UNIX} operating systems,
98+
and will help you get the job done more quickly.
99+
100+
Python is simple to use, but it is a real programming language,
101+
offering much more structure and support for large programs than shell
102+
scripts or batch files can offer. On the other hand, Python also
103+
offers much more error checking than C, and, being a
104+
\emph{very-high-level language}, it has high-level data types built
105+
in, such as flexible arrays and dictionaries. Because of its more
106+
general data types Python is applicable to a much larger problem
107+
domain than Awk or even Perl, yet many things are at
108+
least as easy in Python as in those languages.
109+
110+
Python allows you to split your program into modules that can be
104111
reused in other Python programs. It comes with a large collection of
105112
standard modules that you can use as the basis of your programs --- or
106113
as examples to start learning to program in Python. Some of these
@@ -115,8 +122,8 @@ \chapter{Whetting Your Appetite \label{intro}}
115122
It is also a handy desk calculator.
116123

117124
Python enables programs to be written compactly and readably. Programs
118-
written in Python are typically much shorter than equivalent C or
119-
\Cpp{} programs, for several reasons:
125+
written in Python are typically much shorter than equivalent C,
126+
\Cpp{}, or Java programs, for several reasons:
120127
\begin{itemize}
121128
\item
122129
the high-level data types allow you to express complex operations in a
@@ -145,7 +152,8 @@ \chapter{Whetting Your Appetite \label{intro}}
145152

146153
Now that you are all excited about Python, you'll want to examine it
147154
in some more detail. Since the best way to learn a language is
148-
to use it, you are invited to do so with this tutorial.
155+
to use it, the tutorial invites you to play with the Python interpreter
156+
as you read.
149157

150158
In the next chapter, the mechanics of using the interpreter are
151159
explained. This is rather mundane information, but essential for

0 commit comments

Comments
 (0)