[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

Enter Python


If this book has achieved its goals, you should by now have a good understanding of
why Python has been called a “next-generation scripting language.” Compared with
similar tools, it has some critical distinctions that we’re finally in a position to
summarize:


Tcl
Like Tcl, Python can be used as an embedded extension language. Unlike Tcl,
Python is also a full-featured programming language. For many, Python’s data
structure tools and support for programming-in-the-large make it useful in more
domains. Tcl demonstrated the utility of integrating interpreted languages with C
modules. Python provides similar functionality plus a powerful, object-oriented
language; it’s not just a command string processor.


Perl
Like Perl, Python can be used for writing shell tools, making it easy to use for system
services. Unlike Perl, Python has a simple, readable syntax and a remarkably co-
herent design. For some, this makes Python easier to use and a better choice for
programs that must be reused or maintained by others. Without question, Perl is
a powerful system administration tool. But once we move beyond processing text
and files, Python’s features become attractive.


Scheme/Lisp
Like Scheme (and Lisp), Python supports dynamic typing, incremental develop-
ment, and metaprogramming; it exposes the interpreter’s state and supports run-
time program construction. Unlike Lisp, Python has a procedural syntax that is
familiar to users of mainstream languages such as C and Pascal. If extensions are
to be coded by end users, this can be a major advantage.


Smalltalk
Like Smalltalk, Python supports object-oriented programming (OOP) in the con-
text of a highly dynamic language. Unlike Smalltalk, Python doesn’t extend the
object system to include fundamental program control flow constructs. Users need
not come to grips with the concept of if statements as message-receiving objects
to use Python—Python is more conventional.


Icon
Like Icon, Python supports a variety of high-level datatypes and operations such
as lists, dictionaries, and slicing. In more recent times, Python’s notions of iteration
and generators approach Icon’s backtracking in utility. Unlike Icon, Python is fun-
damentally simple. Programmers (and end users) don’t need to master esoteric
concepts such as full-blown backtracking just to get started.


BASIC
Like modern structured BASIC dialects, Python has an interpretive/interactive na-
ture. Unlike most BASICs, Python includes standard support for advanced pro-
gramming features such as classes, modules, exceptions, high-level datatypes, and


Enter Python| 1547
Free download pdf