In this series, we look at the most loved languages according to the Stack Overflow developer survey, examine the spread and use cases for each of them, and collect some essential links on how to get started using the language. Up now, #3 on our list: Python.
Python is consistently featured amongst the top most loved languages in our Developer Survey. In 2020, 66.7% of respondents said they want to keep working with Python. Conceived in the late 80s, it’s one of the older languages on our list, coming just below newcomers Rust (2010) and TypeScript (2012)—evidence that original designer Guido van Rossum got a lot right.
Most loved languages in 2020 in the Developer Survey
Python’s quirky name—in honor of the cult comedy show, Monty Python—belies the fact that this is a hugely expressive language. While it’s not primarily used for performance-intensive programming, it’s often highly efficient to write, and programs tend to be clear and readable. This makes it ideally suited for applications like data science and web development, and it’s used in a wide range of fields, from healthcare and finance to VFX and AI.
Some regard it as an ideal language for beginners: many terms are expressed using English words rather than symbols, its strict rules about whitespace mean all programs are visually consistent, and code written in Python is often more concise than the equivalent in other languages.
History of use
Trending tags on Stackoverflow.com
Although Python has been around since the 1.0 release in 1991, its usage has ballooned in recent years. Indeed, as our former data scientist David Robinson noted, since 2012, it has risen above the five other major languages (C++, PHP, Java, JavaScript and C#) in usage as estimated by the number of Stack Overflow question views per month. TIOBE’s 2021 index ranks Python as third in popularity at 10.86%, rapidly gaining on C and Java (16.34% and 11.29% respectively). Today, 44 % of developers and technologists around the world are using Python.
Until recently the language design and development was lead by a single person—Dutch computer scientist Guido van Rossum, who stepped down as Python’s “Benevolent Dictator For Life” in 2018 but has remained an active contributor to this day.
Who is using it?
Python is more or less ubiquitous—it would be faster to list industries that don’t use it in some form. While it’s not the language of choice for consumer applications like 3D games or mobile apps, even companies developing these applications frequently use Python for tools and utilities. It is also commonly embedded into software products for automation and scripting purposes—for example, in the VFX field, nearly all of the major software packages (Maya, 3Ds Max, Houdini, Cinema 4D, Blender, and Nuke) have embedded Python interpreters, allowing users to add functionality or automate tasks. It’s used more or less everywhere on Earth and, well, even on Mars.
In fact, if you’re reading this on a Mac, you already have Python installed on your computer—just go to Terminal, type ‘python’, and away you go...
Who is it for?
Students
The use of short English keywords instead of symbols makes Python particularly friendly for beginners. See the example below.
PythonJava# print the integers from 1 to 9 for i in range(1,10): print i// print the integers from 1 to 9 for (int i = 1; i < 10; i++){ System.out.println(i); }
Additionally, Python handles a lot of memory management automatically, so you’ll spend less time dealing with pointers and references and so on than in a language like C++.
It comes bundled with a free IDE (integrated development environment), IDLE, so you can get started quickly. In case you’re wondering, yes, IDLE is a reference to Monty Python’s Eric Idle—if you use Python you’re going to be bombarded with references to vintage British comedy.
Developers who prioritize ease of programming over execution speed
While Python typically runs slower than other common languages like C++ or Java, it’s often much quicker to write—indeed, some estimates suggest a typical program in Python is three to five times shorter than its Java equivalent and five to ten times shorter than the C++ version.
This is one of the reasons it’s often used as a “support language”—software developers rely on it for tasks like build control, automated testing, and bug tracking. For the same reason, it’s also used for prototyping—code can be “hacked together” quickly to test ideas, before perhaps rewriting in a more performant language.
Developers working with text or numbers
Python’s powerful String and List manipulation functions make it a great choice for anyone working with text or numbers. And it’s a great tool for exploring data.
The fact that it doesn’t need compiling means you can rapidly iterate on a program, and, by running Python interactively, you can intuitively manipulate data step-by-step, examining it at each stage.
Python’s core functionality can be extended with a huge arsenal of ‘packages’, many of which are widely used by the scientific and academic communities, as well as fintech and engineering. These include the venerable NumPy (mathematical functions and data analysis), SciPy (for science), Matplotlib (data visualization) and Pandas (data analysis), and more recently TensorFlow and Keras (Machine Learning/AI), as well as tens of thousands of others.
Web developers
Another key area of Python use is backend development. It has built-in support for common protocols like HTML, XML, and JSON, and frameworks like Django, Flask, and Bottle are used widely—for example, Reddit’s backend is Python. Python powers advanced content management, email automation, and more.
Why you shouldn't learn it
There’s a lot to like about Python, but it’s not always the perfect tool for the job.
Perhaps most importantly, Python is an interpreted language, as opposed to a compiled language like C++. While that means there’s no sitting around waiting for your code to compile, it also means the computer has to do extra work every time the program runs, inherently limiting performance. So you’re probably not going to be writing the next blockbuster 60FPS first-person shooter in Python, but it’s perfect for situations like data manipulation where you’re likely to spend more time writing the program than running it.
Additionally, Python’s somewhat unusual syntax means that—if it’s your first language—not all of the knowledge you gain will be transferable to other languages, although many of the underlying concepts are identical. For example, the reduced reliance on brackets and braces, the use of English words instead of symbols, and the enforced usage of whitespace mean that a program in Python may be visually structured in a very different way to the equivalent code in Java or C++.
However, these downsides are often a small price to pay for the many benefits, as evidenced by its ubiquity.
Key concepts
The core philosophies are summarized—in Pythonic fashion—in “The Zen Of Python.” These include:
- “Readability counts
- Simple is better than complex
- There should be one—and preferably only one—obvious way to do it”
In case you were wondering, The Zen Of Python is available in catchy musical form here.
Resources
Official
- The official tutorial is a quick primer on all the basics, perfect for getting up and running quickly.
- The Python language reference provides full documentation in a no-nonsense manner that is “terse, but attempts to be exact and complete.”
- Following the official PEP-8 Style Guide will make your code more readable to other programmers, including the most crucial audience of all—your future self.
- The official site also offers an enormous wealth of information, tutorials, and also features curated content in dozens of languages.
Entry-level
- LearnPython.org offers a quick, well-thought-out series of basic lessons, and provides a friendly browser-based Python interface to experiment with.
- Code The Blocks provides an engaging series of beginner exercises, using a browser-based Python interpreter to manipulate a 3D scene.
- FreeCodeCamp.org offers a free video course that will take you from novice to intermediate in four hours.
- The classic How to Think Like a Computer Scientist is available in a Python 3 edition that will get you up to speed on Python syntax while providing insights that will be valuable in any language.
- While not Python-exclusive, Project Euler offers a set of challenges that are perfect for flexing your new-found Python muscles. The site is a sequence of over 700 mathematical puzzles, to which the answer is always a single integer, and the problems range from the trivial to the extremely difficult. You can of course find hints and tips on Stack Overflow—no cheating though!
- Project Rosalind offers a similarly structured set of problems—this time from the field of Bioinformatics—that function as both an introduction to Python and molecular biology.
Advanced
- The Hitchhiker’s Guide to Python! A hands-on guide for prob
- Moving To Python From Other Languages offers a quick guide to Python concepts and gotchas.
- Rafe Kettler’s A Guide to Python’s Magic Methods offers a detailed explanation of “Magic Methods”—the Python-specific built-in functions like `__init__()` that you may have been using without even thinking about
- Python is generally considered to be simple to learn if you already understand the general concepts of programming… although Learn Python in 10 Minutes is a pretty bold claim!
Other resources
- If you didn’t have time for the 10 minutes one, how aboutLearn Python in 5 Minutes? It actually runs over by a minute or so, but it’s still a pretty impressive speedrun of the basics.
- At the other end of the spectrum, Transforming Code into Beautiful, Idiomatic Python features expert tips for writing “Pythonic” code, which takes full advantage of some of its elegant features rather than simply translating from another language.
- A charming lecture from Python creator Guido van Rossum
Communities
- PythonistaCafe is a friendly, moderated community of Python developers of all skill levels.
- Python has an active Discord channel at https://discord.com/invite/python
Top conferences
- International PyCon events.
- Other Python conferences by country
More about Python, or in fact any other technology tag you can find on the Stack Overflow Tag info page.
Interested in job opportunities with Python? Check out those on our job board?
Learning or teaching Python and got a recommendation for our list? Add yours in the comments section!