This is a cache of https://developer.ibm.com/articles/python-overview-and-basics/. It is a snapshot of the page as it appeared on 2025-11-16T02:44:27.009+0000.
Learn the basics of Python - IBM Developer

Article

Learn the basics of Python

Get an overview of how Python started, major milestones it hit along the way, and where it is today

By

Steve Martinelli

From humble origins

Python was created by Guido Van Rossum and was first released in 1991 as version 0.9. Since that time, there have been over 25 versions of Python released. Notably, version 1.0 was released in January 1994, version 2.0 in October 2000, and version 3.0 in December 2008.

In the last 20+ years, Python has become immensely popular. Python now comes preinstalled, or can be installed, on many different operating systems, including the many versions of UNIX, as well as MacOS and Windows. For Linux distributions, Python packages can be found on both Debian and RPM. On MacOS, Python can be installed with Homebrew.

Python has steadily been one of the most loved languages in StackOverflow's annual survey, and many popular services like Amazon Web Services (AWS), Square, and countless others provide SDKs written in Python. So, what makes Python such a popular programming language? The reasons include:

  • A focus on readability makes it easy for beginners to learn.
  • It's applicable for scripting, functional programming, and object-oriented programming.
  • The standard library includes methods and data structures so that you don’t have to re-create functions.
  • There are many well-maintained and stable third-party libraries in the greater Python ecosystem.
  • The rise of cloud computing, data science, and machine learning.

Being Pythonic

A major design philosophy in Python is being Pythonic, an attitude that emphasizes that code should be readable, concise, and use built-in features as much as possible. Let’s look at the following code snippet examples. The first is how you might write a for loop in Python assuming a more traditional programming approach.

for (int i = 0; i < items.size(); i++) {
    System.out.println(items.get(i));
}

This approach can be replicated in Python with the following syntax.

i = 0
while i < len(items):
  print(items[i])
   i += 1

However, the previous approach isn’t as concise as it can be. Let’s try to be Pythonic and write this in a much more succinct manner.

for x in items:
    print(x)

That’s it! Just two lines, and not even that many characters per line. No need to create a new variable just to store the index.

Another fun example is how you remove elements from a list while iterating through the list. In Java™ programming, this looks like the following code example.

ListIterator<Object> iter = items.listIterator();
while(iter.hasNext()){
    // determine if something should be removed and then remove it
    if(determine(iter.next().getId())){
        iter.remove();
    }
}

Meanwhile, in Python you can do this in one line with a list comprehension.

items = [x for x in items if not determine(x)]

The Zen of Python

Eventually, 19 bits of wisdom on how to create Python programs were collected and labeled the Zen of Python. It was released in 2004, is included in the Python language by process of a PEP (more on this later), and remains included today as an Easter egg. The Zen of Python can be seen by running the import this command in a Python shell. The first few entries are the essence of writing Pythonic code.

  • Beautiful is better than ugly.
  • Explicit is better than implicit.
  • Simple is better than complex.
  • Complex is better than complicated.
  • Readability counts.

Finding the Zen of Python code

Try this yourself by going to https://www.python.org/shell/ and entering import this into the shell.

Python 2 versus Python 3

Python 3 made backwards-incompatible changes and affected major parts of the language, like unifying string and Unicode, adding typing (in later versions), and even affected print(), the most basic way of creating some output.

However, there were libraries that helped, so someone could write Python code that worked on both versions of Python. Notably, one library (aptly named) was “six”. Six would act as a translator between the two versions and run a command the correct way, depending on whether it detected that the runtime was Python 2 or Python 3.

Unfortunately, moving everyone over to Python 3 was not an easy task. Many third-party libraries had to move over as well, and operating systems often packaged both versions of Python at the same time. This lead to more than a little confusion.

Recall that Python 3.0 was first released in 2008, with nearly one version every year since then. A “final” version of Python 2, version 2.7, was released in 2010. However, it received security fixes until 2019 and was supported until January 1, 2020. There was even a website with a countdown made by the community.

Python release cycle

Powered by Python

The 2010s brought many new and exciting frontiers for technologists. Companies were built and grew on the cloud, open source projects became more mainstream, and machine learning was showing us insights into our data.

Powering the open source cloud

OpenStack, an open source Information as a Service (IaaS) project, was first released in 2010 and is almost entirely written in Python. OpenStack is one of the biggest open source projects in the world and has many uses in the private cloud, telecommunication, and education space. You can read more about OpenStack at OpenStack at 12. While working on the OpenStack project, I noticed that many developers from the greater Python community would contribute their expertise on OpenStack projects and vice-versa. OpenStack developers were consumers of many popular Python libraries for testing, database, and identity libraries. It was not uncommon for OpenStack developers to find issues with these libraries and push changes back to their maintainers.

Python in the cloud

With cloud computing becoming increasingly common, platforms that allowed you to choose a runtime were a convenient way for developers to create applications. Coupled with the popularity of Python, it was not unusual to see Python as a well-documented, first-party platform.

Heroku, a popular cloud provider for developers, also publishes a Python buildpack. On the containers side, you can find official Python Docker Hub images, and Red Hat OpenShift includes Python as a supported Source-to-Image option.

Data science

Going hand-in-hand with the rise of cloud computing came the rise of data science and machine learning. And, Python’s easy-to-read syntax ability to be used as a scripting language made for a perfect tool for data scientists.

A Jupyter Notebook is an open source tool that lets data scientists create and share notebooks that contain code. Though there are a number of languages that are supported by Jupyter Notebooks, such as R, Markdown, and JavaScript, Python is by far the most used language in a Jupyter Notebook. The following image shows a sample Jupyter Notebook on IBM Cloud Pak for Data running Python code.

Data science

To go along with the rise of Jupyter Notebooks came several other projects to help with building machine learning models, cleaning and visualizing data, and much more. Let’s take a quick look at some of the most popular Python-based libraries for data science and machine learning.

  • Tensorflow: The core open source library to help you develop and train machine learning models
  • PyTorch: A machine learning framework that accelerates the path from research prototyping to production deployment
  • Keras: A deep learning API written in Python that enables fast experimentation
  • Pandas: A fast, powerful, flexible, and easy-to-use open source data analysis and manipulation tool built on Python
  • Matplotlib: A comprehensive library for creating static, animated, and interactive visualizations in Python

Acronyms to know

What’s pypi?

The Python Package Index (PyPI) hosts packages for many popular Python libraries. Fueled by sponsors, both corporate and individual, PyPI is able to support over 500,000 users, nearly 400,000 projects, and millions of downloads every day. Signing up and publishing your own library is free, allowing every Python developer access to the same high-quality resources that projects all over the world use. The source code for PyPI can be found in the pypa/warehouse repo. If you’re familiar with Node.js, pypi.org would be analogous to npmjs.com. The following image shows the PyPI page for the requests library.

pypi page for the requests library

What’s pip?

pip is Python’s de facto package installer. If you’d like to install a Python package onto your system, you’d run something like the following code.

pip install requests

Then, you can start using the requests library in your code. Convention dictates that any third-party library that a project consumes should be included in a requirements.txt file at the top level of the project. Some projects also separate libraries that are needed for testing and running the code, leaving test-specific libraries in a test-requirements.txt file.

The following code example is a snippet from the requirements.txt file from the openstack/keystone project.

pbr!=2.1.0,>=2.0.0 # Apache-2.0
WebOb>=1.7.1 # MIT
Flask!=0.11,>=1.0.2  # BSD
Flask-RESTful>=0.3.5  # BSD
cryptography>=2.7 # BSD/Apache-2.0
SQLAlchemy>=1.3.0 # MIT

Note that you specify each library in its own line, and you can further specify a minimum and maximum version and any versions to exclude. Again, if you’re familiar with Node.js, a requirements.txt file would be analogous to a package.json file.

What’s a PEP?

PEP is short for Python Enhancement Proposal. A PEP is essentially a proposal to the people who are maintaining future Python versions to include or remove new features to the next version of Python. There have been thousands of proposals and hundreds have been accepted. A complete list of all PEPs is available online. Notable PEPs include:

What’s the PSF?

Per its mission statement, the Python Software Foundation (PSF) promotes, protects, and advances the Python programming language, and supports and facilitates the growth of a diverse and international community of Python programmers.

To accomplish the first part of its mission, the PSF holds the intellectual property, trademarks, and licensing rights for the Python programming language. For the latter part of its mission, the PSF runs a yearly conference, PyCon, as well as many other events around the world.

Summary

In this article, I covered a history and overview of the Python ecosystem. I explained how and when it started, what propelled its growth, and how it is used today. I also covered some of the common acronyms that you encounter when using Python. In the next part of this series, you'll get hands-on by installing and running some Python code.

Next steps

Ready to get hands on? Learn the basics of the de facto language of AI engineers worldwide? Check out this beginner's guide to Python.