O'Reilly logo

Programming Python, 3rd Edition by Mark Lutz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. As a general-purpose language, Python can be used for almost anything computers are capable of. Its feature set applies to both rapid and longer-term development modes. And from an abstract perspective, any project 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 is a very broad category.

A more specific answer is less easy to formulate. For instance, some use Python as an embedded extension language, and others use it exclusively as a standalone programming tool. 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, system administration scripts

Internet scripting

CGI web sites, Java applets, XML, email, Zope/Plone, CherryPy, Webware, Twisted

GUIs

With tools such as Tk, wxPython, Qt, Gtk, PythonCard, Dabo, Swing, Anygui

Component integration

C/C++ library frontends, product customization

Database access

Persistent object stores, SQL database interfaces

Distributed programming

With client/server APIs like CORBA, CGI, COM, .NET, SOAP, XML-RPC

Rapid-prototyping/development

Tactical run-once programs or deliverable prototypes

Language-based modules

Replacing special-purpose parsers with Python

And more

Image processing, numeric programming, gaming, AI, etc.

On the other hand, Python is not really tied to any particular application area. 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 all of the things described in the following list.

  • A dynamic programming language, ideal 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, ideal for situations in which the complexity of larger languages can be a liability (prototyping, end-user coding, time to market)

  • A generalized language tool, ideal for situations in which we might otherwise need to invent and implement yet another "little language" (programmable system interfaces, configuration tools)

Given these general properties, you can apply Python to any area you'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 as a random sample (with apologies to the very many systems omitted here). You can find more about most of these components in this book, on Python's web site, at the Vaults of Parnassus and PyPI web sites mentioned earlier in this chapter, and by a simple Google web search.

Table 1-2. Popular Python domains, tools, and extensions

Domain

Tools and extensions

Systems programming: support for all common system-level tools

Sockets, processes, threads, signals, pipes, RPC, directories, POSIX bindings...

GUIs: a variety of portable GUI toolkits and builders

Tkinter, wxPython, PyQt, PyGTK, Anygui, Swing, PythonCard, Dabo...

Database interfaces: interfaces for both relational and object-oriented databases

MySQL, Oracle, Sybase, PostgreSQL, SQLite, persistence, ZODB, DBM...

Microsoft Windows tools: access to a variety of Windows-specific tools

MFC wrappers, COM interfaces, ActiveX scripting, ASP, ODBC drivers, .NET...

Internet tools: sockets, CGI, client tools, server tools, web frameworks, parsers, Apache support, Java integration

Jython, XML, email, ElementTree, htmllib, telnetlib, urllib, Zope, CherryPy, Twisted, Webware, Django, mod_python, SSL...

Distributed objects: SOAP web services, XML-RPC, CORBA, DCOM

PySOAP, SOAPy, xmlrpclib, ILU, Fnorb, omniORB, PyWin32...

Other popular tools: graphics, language, visualization, numerics, cryptography, integration, gaming, wikis...

PIL, VPython, Blender, PyOpenGL, NLTK, YAPPS, VTK, NumPy, PyCrypto, SWIG, ctypes, PyGame, MoinMoin...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required