Python's Apache interpreter is available as an Apache module, mod_python. This module reduces the time it takes to deliver a given page to a client. It is also capable of a great deal more, including interacting with Apache itself in various powerful ways. This article gives you just a taste of what mod_python can do.
You enter in an address, requesting a page from Apache. It's not just any old page, though. It's a CGI script written in Python. A few moments later, you're staring at the results. However, what exactly does Apache do with your request? As with all CGI scripts, Apache spawns a new process - in this case, the Python interpreter - and then spits out that process' output. It works, but it isn't the fastest way, nor is it the most efficient way.
Other languages have presented different solutions to this problem. Languages such as PHP have embedded their interpreters into Apache. Other languages, such as Perl, offer Apache modules (in Perl's case, mod_perl) that do this. These "other languages" include Python, though not enough people realize this.
This article deals with Python's own module for Apache, mod_python, and the benefits it provides to both man and machine.
A Quick Look at Mod_Python
As I stated eariler, mod_python embeds the Python interpreter into Apache. This reduces the time needed to deliver a given page to a client. Starting the Python interpreter, waiting for it to finish executing, and then catching its output not only takes time, but it takes up valuable resources as well.
This, however, is not the only benefit provided by mod_python. Mod_python can interact with Apache, giving you extraordinary power. You can change the way Apache handles tasks and utilize the Apache API.
Languages that can be embedded straight into HTML, such as PHP, are very popular. CGI does not allow this. However, mod_python does. You've seen Java Server Pages (JSP) and Active Server Pages (ASP); this article will introduce you to Python Server Pages (PSP).