Programming languages: This major update for Python has just arrived

Core Python developers release the next major version of the world's most popular programming language.
Written by Liam Tung, Contributing Writer

Python, the most popular programming language today, has reached version 3.10, marking the next major release since the decade-long transition from Python 2.7

Tiobe, the compiler of a language popularity index, this week crowned Python as the most popular programming language, placing it ahead of Java, C and JavaScript for the first time in 20 years. The appeal of Python, a 30-year-old language, is it's easy to learn, popular for machine learning and is backed by a big ecosystem of third-party software libraries that make it more useful in artificial intelligence, like Google's TensorFlow and Facebook's PyTorch.   

Python 3.10 succeeds Python 3.9 and has been in the works for over a year as core Python (CPython) developers continued to work on backwards compatibility. CPython is the core implementation of Python, upon which other distributions like data science-focused Anaconda are built. 

"Python 3.10.0 is the newest major release of the Python programming language, and it contains many new features and optimizations," CPython maintainers announced in a blogpost

See also: Programming languages: Python just took a big jump forward.

The upgrade includes dozens of additions known as Python Enhancement Proposals (PEPs). One of the headline features is "structural pattern matching" in Python 3.10 -- a technique for handling data that's already available in C, Java, JavaScript, Scala and Elixir. 

"Structural pattern matching has been added in the form of a match statement and case statements of patterns with associated actions. Patterns consist of sequences, mappings, primitive data types as well as class instances. Pattern matching enables programs to extract information from complex data types, branch on the structure of data, and apply specific actions based on different forms of data," the project explains in release 3.10 notes.  

"While structural pattern matching can be used in its simplest form comparing a variable to a literal in a case statement, its true value for Python lies in its handling of the subject's type and shape," it adds. 

Python core contributors presented the update in a meeting this week. Pablo Galindo Salgado, a physicist and core Python contributor, explained how the project is using Microsoft's GitHub Actions DevOps (CI/CD) tools to test Python changes on Windows, Linux and macOS systems. 

"When you merge something to Python, there is a CI in GitHub Actions, and we have other providers, although we are mainly using GitHub Actions now. It tests your commits on every single commit on Linux, Windows, and macOS," said Salgado. 

"We know that Python works on more platforms, things like FreeBSD, PowerPC and other architectures instead of Intel, such as Arm chips or [Apple's] M1. There are a lot of different architectures," he says. 

"So once the commit lands into the master branch, there are a lot of machines which are called 'billboards', which test commits … some of which are testing CPython in normal mode."

"There are also billboards testing in special configurations such as checking invalid memory addresses using Clang and GCC sanitizers or race conditions, which are breaking all the time because those checks are not executed on every comment because they normally take hours."

See also: Developers wanted: Companies are hiring, and these are skills they're looking for.

The group also noted that PEP 563 was meant to arrive but has been postponed after a debate at the 2020 Python Language Summit in April. At issue was support for the proposal by third-party software libraries and a related PEP 649.

"It's possible that third-party libraries and users didn't plan to react in the current time frame as they were not aware of this change in timing," the Python Steering Council wrote

"There isn't enough time to properly discuss PEP 649 or any of the alternatives before the beta 1 deadline, and we really need to make sure we don't compound errors here.  We need to look for a long-term solution, which isn't possible while still maintaining the release deadlines of Python 3.10. That means we're also deferring PEP 649 to Python 3.11."

See also: Another reason why developers are quitting: To escape from your bad code.

The language's creator, Guido van Rossum, assures that the move to Python 4.0 -- if and when it arrives -- won't be as traumatic as the decade-long shift from Python 2 code to Python 3. 

"If there ever is a version 4, the transition from 3 to 4 will be more like that from 1 to 2 rather than 2 to 3," he noted last year, adding that "we've still got PTSD from 2 to 3." 

Van Rossum announced Python 3 13 years ago, but the project didn't stop supporting Python 2 until last April because of how much legacy code would have been broken by moving to 3. Today he's employed as a distinguished engineer at Microsoft, where he's working on improving the language's performance, which currently limits it to high-end hardware and prevents it from mobile devices and browsers.  

Editorial standards