1.4 What's Python Good For?
Because Python is used in a wide variety of ways, it's almost
impossible to give an authoritative answer to this question. In
general, any application that can benefit from the inclusion of a
language optimized for speed of development is a good target Python
application domain. Given the ever-shrinking schedules in software
development, this a very broad category.
A more specific answer is less easy to formulate. For instance, some
use Python as an embedded extension language, while others use it
exclusively as a standalone programming tool. And to some extent,
this entire book will answer this very question -- it explores
some of Python's most common roles. For now, here's a
summary of some of the more common ways Python is being applied
today:
- System utilities
-
Portable command-line tools, testing systems
- Internet scripting
-
CGI web sites, Java applets, XML, ASP, email tools
- Graphical user interfaces
-
With APIs such as Tk, MFC, Gnome, KDE
- Component integration
-
C/C++ library front-ends, product customization
- Database access
-
Persistent object stores, SQL database system interfaces
- Distributed programming
-
With client/server APIs like CORBA, COM
- Rapid-prototyping /development
-
Throwaway or deliverable prototypes
- Language-based modules
-
Replacing special-purpose parsers with Python
- And more
-
Image processing, numeric programming, AI, etc.
The PSA organization described earlier was originally formed in
response to an early thread on the Python newsgroup, which posed the
semiserious question: "What would happen if Guido was hit by a
bus?"
These days, Guido van Rossum is still the ultimate arbiter of
proposed Python changes, but Python's user base helps support
the language, work on extensions, fix bugs, and so on. In fact,
Python development is now a completely open process -- anyone can
inspect the latest source-code files or submit patches by visiting a
web site (see http://www.python.org for details).
As an open source package, Python development is really in the hands
of a very large cast of developers working in concert around the
world. Given Python's popularity, bus attacks seem less
threatening now than they once did; of course, I can't speak
for Guido.
|
On the other hand, Python is not really tied to any particular
application area at all. For example, Python's integration
support makes it useful for almost any system that can benefit from a
frontend, programmable interface. In abstract terms, Python provides
services that span domains. It is:
A dynamic programming language, for situations in which a
compile/link step is either impossible (on-site customization), or
inconvenient (prototyping, rapid development, system utilities)
A powerful but simple programming language designed for development
speed, for situations in which the complexity of larger languages can
be a liability (prototyping, end-user coding)
A generalized language tool, for situations where we might otherwise
need to invent and implement yet another "little
language" (programmable system interfaces, configuration tools)
Given these general properties, Python can be applied to any area
we're interested in by extending it with domain libraries,
embedding it in an application, or using it all by itself. For
instance, Python's role as a system tools language is due as
much to its built-in interfaces to operating system services as to
the language itself. In fact, because Python was built with
integration in mind, it has naturally given rise to a growing library
of extensions and tools, available as off-the-shelf components to
Python developers. Table 1-2 names just a few; you
can find more about most of these components in this book or on
Python's web site.
Table 1-2. A Few Popular Python Tools and Extensions
Systems programming
|
Sockets, threads, signals, pipes, RPC calls, POSIX bindings
|
Graphical user interfaces
|
Tk, PMW, MFC, X11, wxPython, KDE, Gnome
|
Database interfaces
|
Oracle, Sybase, PostGres, mSQL, persistence, dbm
|
Microsoft Windows tools
|
MFC, COM, ActiveX, ASP, ODBC, .NET
|
Internet tools
|
JPython, CGI tools, HTML/XML parsers, email tools, Zope
|
Distributed objects
|
DCOM, CORBA, ILU, Fnorb
|
Other popular tools
|
SWIG, PIL, regular expressions, NumPy, cryptography
|
|