Skip to content

Module 1 · Introduction to Python — topic 2 of 14

History of Python

How Python grew from a 1989 holiday project into one of the world’s most used languages, and why the Python 2 to Python 3 change still matters when you read old code.

Beginner 12 min read·Lesson 2 of 306 in Python Programming

Learning objectives

  • Describe who created Python and why
  • Explain the difference between Python 2 and Python 3
  • Check which Python version you are running

Definition

How Python grew from a 1989 holiday project into one of the world’s most used languages, and why the Python 2 to Python 3 change still matters when you read old code.

Introduction

Python was started by Guido van Rossum, a Dutch programmer, in December 1989 as a hobby project. He wanted a language that was as powerful as the tools he used at work but much easier to read. The name comes from the comedy group Monty Python, not from the snake.

The first public version, Python 0.9.0, appeared in 1991. Python 1.0 followed in 1994, Python 2.0 in 2000 and Python 3.0 in 2008. Today Python is developed in the open by volunteers and is looked after by the non-profit Python Software Foundation.

Why it matters

Knowing the history helps you make sense of what you find online. Many old tutorials and answers were written for Python 2, which is no longer supported. If you copy that code into Python 3 it may fail, and recognising the reason saves a lot of confusion.

The history also explains Python’s values: readability, simplicity and community decision-making. These values shape how good Python code is written today.

Detailed explanation

Python 3 deliberately broke compatibility with Python 2 to fix design problems. The most visible change is that print became a function, so you write print("hi") with parentheses. Division also changed: in Python 3, 7 / 2 gives 3.5 instead of 3. Text became Unicode by default, which makes handling languages such as Hindi or Tamil much simpler.

Python 2 reached its official end of life on 1 January 2020. All new code should use Python 3, and every lesson in this course does.

Changes to Python are proposed in documents called PEPs (Python Enhancement Proposals). For example, PEP 8 is the style guide you will meet later, and PEP 20, “The Zen of Python”, lists the language’s guiding principles.

YearMilestone
1989Guido van Rossum starts the project
1991First public release (0.9.0)
2000Python 2.0
2008Python 3.0
2020Python 2 retired

Syntax

Python
import sys
print(sys.version_info.major)
  • import sys loads the built-in sys module, which knows about the running interpreter.
  • sys.version_info holds the version numbers.
  • .major is the main version: 3 for Python 3.

Code examples

Division in Python 3

Python
print(7 / 2)
Output
3.5

Python 3 always gives the exact result of /, even for whole numbers.

The Zen of Python

Python
import this

Running this line prints the 19 guiding principles of Python, such as “Readability counts.” Try it on your own computer.

More examples

Checking you are on Python 3

Python
import sys
major = sys.version_info.major
if major >= 3:
print("Python 3: ready for this course")
else:
print("Please install Python 3")
Output
Python 3: ready for this course

Step-by-step explanation

  • import sys gives the program access to information about the interpreter.
  • major = sys.version_info.major stores the main version number.
  • The if statement checks whether that number is at least 3.
  • Only one of the two print lines runs, depending on the check.

Expected output

Running “Checking you are on Python 3” prints exactly:

TextOutput
Python 3: ready for this course

Practical applications

  • Companies still migrating old Python 2 systems compare versions exactly like this before running scripts.
  • Open-source projects state the oldest Python 3 version they support so users know what to install.
  • Teams read PEPs to understand why a language feature works the way it does.

Best practices

  • Use the latest stable Python 3 release for new work.
  • When you read code online, check whether it was written for Python 2.
  • Read “The Zen of Python” once; its advice applies to every program you write.

Common mistakes

Copying Python 2 print statements

Avoid

print "Hello"

Prefer

print("Hello")

In Python 3 print is a function and needs parentheses. The old form raises a SyntaxError.

Expecting whole-number division from /

Avoid

half = 7 / 2 # expecting 3

Prefer

half = 7 // 2 # gives 3

In Python 3, / always returns a float. Use // when you want to drop the fractional part.

Key takeaways

  • Guido van Rossum created Python; it was first released in 1991.
  • Python 3 (2008) replaced Python 2, which was retired in 2020.
  • In Python 3, print needs parentheses and / returns a float.

Try it yourself

  1. 1
    Run import this on your computer and pick the two principles you find most useful. Write them down in your own words.
  2. 2
    Predict what print(9 / 3) shows in Python 3, then check.
    Show hint

    Think about the type that / always returns.

Finished reading? Mark it complete to update your dashboard.

Suggested practice

1 question test this exact topic. Answers and explanations are revealed after you submit.

  • BeginnerWho created Python?
Practise this topic