Python Monthly News

Python News: What's New From March 2022

In March 2022, the Python 3.11.0a6 pre-release version became available for you to test, so you can stay on top of Python’s latest features. This release is the sixth of seven planned alpha releases before Python enters the beta phase, which is scheduled for May 5, 2022.

PEPs now have a new home with a sleek, modern theme. Also, PEP 594, which deals with removing dead batteries from the Python standard library, has been accepted. Regarding Python events, EuroPython 2022 held its call for proposals (CFP) and is currently selling tickets for the conference.

Let’s dive into the most exciting Python news from the past month!

Python Released Several New Versions

Almost every month, several Python versions are released. They typically add new features, fix bugs, correct security issues, and more. March 2022 was no exception. You now have several new releases to test, use, and enjoy. Read on to learn more!

Python 3.11.0a6 Became Available

The sixth alpha release of Python became available on March 7. After a week’s delay due to some internal problems, Python 3.11.0a6 is here for you to take for a test drive. Python 3.11 boasts several new features and changes:

  • PEP 657 – Include Fine-Grained Error Locations in Tracebacks
  • PEP 654 – Exception Groups and except*
  • PEP 673 – Self Type
  • PEP 646 – Variadic Generics

To learn more about the basics of these features, check out Python News: What’s New From February 2022?. Additionally, if you’d like an early dive into how fine-grained error locations can improve your coding and debugging experience, check out Python 3.11 Preview: Even Better Error Messages.

To try out the most exciting features that will come with Python 3.11 and to stay up to date with the language’s evolution, go ahead and install the new interpreter. Feel free to select your favorite installation procedure below:

Shell
$ docker pull python:3.11.0a6-slim
$ docker run -it --rm python:3.11.0a6-slim

Shell
$ pyenv update
$ pyenv install 3.11.0a6
$ pyenv local 3.11.0a6
$ python

Shell
$ git clone git@github.com:python/cpython.git
$ cd cpython/
$ git checkout v3.11.0a6
$ ./configure
$ make
$ ./python

Give it a try! Go your own way and explore the cool new features of Python 3.11 with your own hands!

Other Python Releases

Several other Python versions have seen the light of day this month. Python 3.10.3, 3.9.11, 3.8.13, and 3.7.13 are now available with several security corrections, making them more robust and reliable.

March also welcomed two last-minute Python versions, 3.10.4 and 3.9.12. They were released outside the regular schedule to quickly fix a regression that caused Python to no longer build on Red Hat Enterprise Linux 6:

Release Python 3.10.4 and 3.9.12
Image source

Even though this operating system is quite old, it still supports a considerable production workload, including a few services in Python’s infrastructure, such as the manylinux2010 image. This image is based on CentOS 6, which was also affected by the issue.

Because these are last-minute releases, they just add a few bug fixes and security corrections on top of their respective previous versions.

Python Published a New Website for PEPs

Python Enhancement Proposals, more commonly known as PEPs, now have a brand-new home with a dedicated URL at peps.python.org. This new website puts its best face forward, with a shiny theme that looks clean and modern:

Python PEPs New Website
Image source

If you direct your browser to this address, then you’ll land on PEP 0, which is the index of all PEPs. There, you’ll find all the PEPs carefully organized by category and number.

The site also includes handy information about the PEPs themselves. You’ll find the PEP type and its current status. The PEP’s status is handy because it allows you to quickly learn if a given PEP has been accepted or rejected, or if it’s in another stage.

Go ahead and take a look at this new PEPs website. You won’t regret it!

Dead Batteries Will Be Removed From the Standard Library

Python is well-known for having a standard library with an extensive collection of useful modules and packages. Because of its broad standard library, Python is often referred to as a batteries-included language, which has been an important cornerstone of Python’s success story. With time, some of these batteries have stopped being useful or convenient. However, they’ve remained, bloating the standard library.

Python’s standard library has been filling up with poorly designed modules, unnecessary duplication, and nonessential features.

To counter this trend, the Python Steering Council has accepted PEP 594:

Pep 594 Accepted Tweet
Image source

The PEP’s primary goal is to remove dead batteries from the standard library. In other words, the PEP proposes a list of modules to be removed from the standard library in future Python releases. The candidate modules will include modules that:

  • Support old file formats, such as those associated with Commodore and SUN
  • Support APIs and operating systems that were superseded a long time ago, such as macOS 9
  • Have no current maintainer
  • Are poorly designed and almost impossible to fix, such as sgi
  • Imply security risks, such as crypt and spwd
  • Have better alternatives outside the library

This PEP has other specific goals, which include:

  • Freeing the core development team from maintaining unused code
  • Directing the user to better solutions that are typically available in the third-party ecosystem
  • Lowering the requirements for platforms with limited storage capabilities

The proposed calendar for removing these dead batteries includes issuing a DeprecationWarning starting from Python 3.11 and finally removing them definitively in Python 3.13. It’s advisable to check your projects, see if they use any of these dead batteries, and find suitable replacements.

MyPy Supports the match Statement Experimentally

Python 3.10 introduced the match and case statements to bring structural pattern matching into the language. This feature turned out to be one of the most controversial ones in Python. It enables your programs to extract information from complex data types, branch on the structure of data, and apply specific actions based on different forms of data.

Typically, tools like code linters and formatters have a natural delay when it comes to adopting changes in the target language’s syntax. That’s the case of MyPy, which provides an optional yet popular static type checker for Python.

In happy news, MyPy released version 0.940 on March 11. This new version has experimental support for type checking match and case statements. You can try it out now! Go ahead and install MyPy in a Python virtual environment:

Windows PowerShell
PS> python -m venv venv
PS> venv\Scripts\activate
(venv) PS> python -m pip install mypy
Shell
$ python -m venv venv
$ source venv/bin/activate
(venv) $ python -m pip install mypy

The first two commands create and activate a brand-new virtual environment in your current directory. The third command installs the latest version of MyPy, which should be 0.940 or greater.

Now create a Python file called try_mypy.py. Once you have the file open in your favorite text editor, then copy and paste the code example from the MyPy 0.940 release post:

Python
# try_mypy.py

def empty_value(x: int | str) -> str:
    match x:
        case str():
            # Type of "x" is "str" here
            return '""'
        case int():
            # Type of "x" is "int" here
            return "0"
    # No error about missing return statement (unreachable)

This function takes an x argument that can be either a string or an integer number. The matchcase statement returns an empty string if x is of type str, or "0" if x is an int. If you run the mypy command against this file, then you’ll get the following result:

Shell
$ python -m mypy try_mypy.py
Success: no issues found in 1 source file

Cool! Now MyPy can detect that x will be of either type str or int without issuing an error report. MyPy can correctly parse the matchcase statement and suppress the "missing return statement" error report.

Check out the release notes for more information about the current limitations of this experimental feature.

EuroPython 2022 Announced Its CFP and Tickets Sale

After two years of remote events over Zoom, Matrix, and Discord, EuroPython is committed to an in-person conference in 2022. It’ll also be offered virtually for those who can’t travel to Dublin:

EuroPython 2022
Image source

The conference will take place from July 11 to 17! It’ll host the following events:

  • Two Workshop/Tutorial Days (July 11-12, Monday-Tuesday)
  • Three Conference Days (July 13-15, Wednesday-Friday)
  • Sprint Weekend (July 16-17, Saturday-Sunday)

The conference will take place at The CCD in Dublin:

The Convention Center Dublin Google Maps Location
Image source

The EuroPython 2022 team opened the call for proposals (CFP) on March 8. In this CFP, EuroPython was looking for proposals on every aspect of Python, including:

  • Programming from novice to advanced levels
  • Applications and frameworks
  • Experiences in introducing Python into your organization

Undoubtedly, this EuroPython will be an amazing conference with a lot of interesting talks and activities that will definitely contribute a ton of knowledge to the world’s Python community.

The CFP closed on Sunday, April 3. Did you send your proposal? Let us know in the comments!

Do you want to contribute to the conference as a volunteer? Well, this is your opportunity. EuroPython is organized and run by volunteers from the Python community. So, new faces are always welcome!

In turn, you’ll have a safe space to share your thoughts and work. You’ll be shaping the conference, ensuring it’s for the community and of the community. Of course, you’ll also have a lot of fun in the process! If you’re interested in joining one of the teams, then send an email to volunteers@europython.eu.

Finally, the EuroPython 2022 team also opened ticket sales on March 17. If you haven’t gotten your ticket, then go ahead and take the plunge. Do you need financial aid? Well, EuroPython 2022 can also help you with this. Check out their Financial Aid page for more info.

What’s Next for Python?

So, what’s your favorite piece of Python news from March? Did we miss anything notable? Are you going to give Python 3.11.0a6 a try? What do you think about removing dead batteries from the standard library? Do you plan to attend to EuroPython 2022? Let us know in the comments!

Happy Pythoning!

🐍 Python Tricks 💌

Get a short & sweet Python Trick delivered to your inbox every couple of days. No spam ever. Unsubscribe any time. Curated by the Real Python team.

Python Tricks Dictionary Merge

About Leodanis Pozo Ramos

Leodanis Pozo Ramos Leodanis Pozo Ramos

Leodanis is an industrial engineer who loves Python and software development. He's a self-taught Python developer with 6+ years of experience. He's an avid technical writer with a growing number of articles published on Real Python and other sites.

» More about Leodanis

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Master Real-World Python Skills With Unlimited Access to Real Python

Locked learning resources

Join us and get access to thousands of tutorials, hands-on video courses, and a community of expert Pythonistas:

Level Up Your Python Skills »

Master Real-World Python Skills
With Unlimited Access to Real Python

Locked learning resources

Join us and get access to thousands of tutorials, hands-on video courses, and a community of expert Pythonistas:

Level Up Your Python Skills »

What Do You Think?

Rate this article:

What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment below and let us know.

Commenting Tips: The most useful comments are those written with the goal of learning from or helping out other students. Get tips for asking good questions and get answers to common questions in our support portal.


Looking for a real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

Keep Learning

Related Tutorial Categories: community