MCS-201 · Unit 9

Introduction to Python

Section 2 of 7

Block 3 · Unit 9Introduction to Python9 min · Section 2 of 7

9.2History and Implementations of Python

Covers IGNOU MCS-201 §9.2

Knowing a little history explains things you will meet constantly: why old tutorials use print "hello", why “Python 2 code” fails today, and why there is more than one “Python”. This section covers the timeline and the main implementations.

Timeline

YearEvent
Late 1980sGuido van Rossum, at CWI in the Netherlands, starts Python as a successor to the teaching language ABC (work begins December 1989)
1991First public release (0.9.0)
1994Python 1.0
2000Python 2.0: list comprehensions, a garbage collector that can free reference cycles, and the start of the PEP process
2008Python 3.0: a major cleanup that is deliberately not fully backward-compatible
2010Python 2.7, the last 2.x version
2020Python 2 reaches end of life on 1 January 2020 (final release 2.7.18 in April 2020); no more fixes, even for security
Since 2019A new Python 3 version is released every October (3.15 in October 2026)

A PEP (Python Enhancement Proposal) is a design document that proposes a change to Python and records the decision; for example, PEP 8 is the style guide.

Python 2 versus Python 3

Python 3 fixed design problems that could not be fixed without breaking old code. The differences you are most likely to see:

Python 2Python 3
Printingprint "Hi" (a statement)print("Hi") (a function)
Division 7 / 23 (integer division for integers)3.5 (true division); use 7 // 2 for 3
TextBytes by default; Unicode needed a u prefixAll strings are Unicode
Reading inputraw_input()input()
StatusDead since 2020The only maintained version

Implementations

The language Python is a specification; an implementation is a program that actually runs Python code.

ImplementationWritten inRuns onNotes
CPythonCIts own bytecode virtual machineThe reference implementation from python.org; the one you install by default; best compatibility with packages and C extension modules
PyPyRPython (a restricted subset of Python)Its own VM with a just-in-time (JIT) compilerOften several times faster than CPython for long-running pure-Python code
JythonJavaJava Virtual MachineCan use Java classes directly; supports only Python 2.7
IronPythonC#.NET Common Language RuntimeCan use .NET libraries; no global interpreter lock, so threads can use several cores
MicroPythonCMicrocontrollers (and PCs)A small, separate reimplementation of Python 3 for devices with very little memory

A just-in-time (JIT) compiler watches which parts of the program run often and translates them into machine code while the program runs, which removes much of the interpreter’s overhead.

Key takeaways

  • Created by Guido van Rossum; first released in 1991; Python 3 since 2008.
  • Python 2 ended on 1 January 2020; always use Python 3.
  • CPython is the reference implementation; PyPy adds a JIT; Jython and IronPython run on the JVM and .NET; MicroPython runs on microcontrollers.
  • PEPs record how Python changes.

Practice questions

Answer on paper first, then check. The explanation matters more than the letter you chose.

Question 1 · multiple choice

Who created Python?

Show answer

Answer: B. Guido van Rossum

Guido van Rossum started Python at CWI in the Netherlands. Ritchie created C, Gosling Java and Stroustrup C++.

Question 2 · multiple choice

What does print(7 / 2, 7 // 2) display in Python 3?

Show answer

Answer: C. 3.5 3

/ is true division in Python 3; // is floor division.

Question 3 · multiple choice

Which implementation uses a just-in-time compiler to speed up Python code?

Show answer

Answer: A. PyPy

PyPy’s JIT translates frequently executed code to machine code while the program runs.

Question 4 · multiple choice

Which implementation lets Python code use Java class libraries directly?

Show answer

Answer: D. Jython

Jython runs on the Java Virtual Machine. IronPython does the same for .NET libraries.

Question 5 · multiple choice

When did Python 2 reach its end of life?

Show answer

Answer: C. 1 January 2020

After 1 January 2020 no further fixes were made; 2.7.18 (April 2020) was the final release.

Question 6 · short answer

Explain the difference between the Python language and CPython, and why the difference matters when choosing libraries.

Show worked answer

The Python language is the set of rules for what Python code means; CPython is the standard program, written in C, that compiles and runs that code. Other implementations (PyPy, Jython, IronPython, MicroPython) run the same language differently. It matters because many popular libraries, such as NumPy and pandas, contain C extension modules written for CPython’s internal interface, so they work fully only on CPython (and partly on PyPy) but not on Jython or MicroPython.

↑ ↓ move↵ openTab switch type