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.

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

Domain

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

Get Programming Python, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.