1 Throughout this book, we’ll mention some highlights of Python 3.6, just barely released as we
write—while 3.6 may not yet be mature enough for you to use in production releases, knowing
what’s coming as 3.6 does mature can’t fail to be helpful to your technical choices.
alpha. PyPy has substantial advantages in speed and memory management, and is
seeing production-level use.
Choosing Between CPython, Jython, IronPython, and PyPy
If your platform, as most are, is able to run all of CPython, Jython, IronPython, and
PyPy, how do you choose among them? First of all, don’t choose prematurely:
download and install them all. They coexist without problems, and they’re all free.
Having them all on your development machine costs only some download time and
a little extra disk space, and lets you compare them directly.
The primary difference between the implementations is the environment in which
they run and the libraries and frameworks they can use. If you need a JVM environ‐
ment, then Jython is your best choice. If you need a CLR (AKA “.NET”) environ‐
ment, take advantage of IronPython. If you need a custom version of Python, or
need high performance for long-running programs, consider PyPy.
If you’re mainly working in a traditional environment, CPython is an excellent fit. If
you don’t have a strong preference for one or the other, start with the standard CPy‐
thon reference implementation, which is most widely supported by third-party add-
ons and extensions, and offers the highly preferable v3 (in full 3.5 glory).
1
In other words, when you’re experimenting, learning, and trying things out, use
CPython, most widely supported and mature. To develop and deploy, your best
choice depends on the extension modules you want to use and how you want to dis‐
tribute your programs. CPython applications are often faster than Jython or IronPy‐
thon, particularly if you use extension modules such as NumPy (covered in “Array
Processing” on page 444); however, PyPy can often be even faster, thanks to just-in-
time compilation to machine code. It may be worthwhile to benchmark your CPy‐
thon code against PyPy.
CPython is most mature: it has been around longer, while Jython, IronPython, and
PyPy are newer and less proven in the field. The development of CPython versions
tends to proceed ahead of that of Jython, IronPython, and PyPy: at the time of writ‐
ing, for example, the language level supported is, for v2, 2.7 for all of them; for v3,
3.5 and 3.6 are now available in CPython, and PyPy has 3.5 in alpha.
However, Jython can use any Java class as an extension module, whether the class
comes from a standard Java library, a third-party library, or a library you develop
yourself. Similarly, IronPython can use any CLR class, whether from the standard
CLR libraries, or coded in C#, Visual Basic .NET, or other CLR-compliant
languages. PyPy is drop-in compatible with most standard CPython libraries, and
Intro to
Python
Python Implementations | 7