Book Image

Python Essentials

By : Steven F. Lott
Book Image

Python Essentials

By: Steven F. Lott

Overview of this book

Table of Contents (22 chapters)
Python Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Looking at other Python interpreters


This book will focus on a particular implementation of Python called the CPython. What this means is that Python—the abstract language—can be processed by a variety of concrete Python runtimes or implementations. The CPython implementation is written in portable C and can be recompiled for many operating systems.

Python can be embedded into an application. This means that a complex application can include the entire Python language as a way to write scripts that customize the given application. One example of this is the Ganglia monitoring system (http://ganglia.sourceforge.net). Python is part of the system; we can customize the behavior using Python scripts that will interact with Ganglia components. We won't be looking more deeply into these kinds of applications in this book; we'll focus on standalone implementations of Python.

There are several alternative Python implementations. In the Installing Python on Windows section in this chapter, we noted that Iron Python (http://ironpython.net) and PTVS (http://pytools.codeplex.com) are available. These provide tighter integration with the .NET framework.

There are still more implementations that we might encounter:

  • Jython: This is a version of the Python interpreter that is written in Java and runs on the Java Virtual Machine (JVM). See http://www.jython.org. This project focuses on Python 2.7.

  • PyPy: This is a version of the Python interpreter written in Python. See http://pypy.org. The circularity of "Python written in Python" is broken by the RPython translation toolchain, which creates a very sophisticated implementation of Python programs. This can provide significant performance improvements for a variety of long-running applications, such as web servers.

  • Stackless: This version of Python has a different threading model from CPython. See http://www.stackless.com. This version can provide dramatic performance improvements for multithreaded servers.

Since the Python source is readily available, it's quite easy to look for optimization opportunities. The language is relatively simple, allowing experimentation to see what effect changes in implementation may have.