Programming languages: This major update for Python has just arrived
Python, the most popular programming language today, has reached version 3.10, marking the the next major release since the decade-long transition from Python 2.7.
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-focussed Anaconda are built.
SEE: Programming languages: Python just took a big jump forward
“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 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: 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: 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.