The Python 3.11 release: everything you need to know

The Python 3.11 release: everything you need to know

As per Python Software Foundation (PSF) the release of Python 3.11, which is scheduled for October 2022, is currently in its seventh alpha revision.

Python is now regularly linked to the most significant advances in data science and AI. Practitioners value its simplicity, extensive collection of in-built and third-party libraries, and network. The Python community can anticipate a number of positive enhancements, including a considerable performance gain, better error detection and debug, and several quality-of-life upgrades to standard libraries, with the release of its latest version of 3.11 on October 3, 2022.

What modifications are made to the forthcoming version? Let’s have a look.

Python 3.11 Introduces New Features and Functionality

?The complete list of enhancements included in Python 3.11 is as follows:

General alterations

  • Improved Speed –?The usual benchmark suite runs around 25% quicker than in 3.10, which is the first notable change that will thrill data scientists. According to the Python documentation, 3.11 can occasionally be up to 60% quicker. Here’s how to run the benchmark test to evaluate speed gains on your own computer. You will require a Docker installation in order to compare the speeds of Python 3.10 and 3.11.
  • Smooth Error Locations in Tracebacks for Easier Debugging –?In the past, lines would be used to identify errors. The specific error will now be underlined on the line, removing any ambiguity and accelerating troubleshooting.
  • ?Using Exception Groups and except, error handling is made easier –?Previously, if a task produced numerous errors, you had to address each one separately. With version 3.11, you can now handle each of those problems separately, which streamlines exception handling.
  • Standard Library support for TOML parsing –?A customization file format comparable to YAML is called TOML, or Tom’s Obvious Minimal Language. It includes reliable and consistent build information for your project. There is no longer any justification for using setup.py to package your project since 3.11 added tomllib to the standard library.?

Typing and Language Changes

  • Self Type –?The annotation of self returns has been awkward for a long time, resulting in confusing results from your analysis tools. “typing.Self” simplifies the annotation process by allowing you to just annotate the return value.
  • Variadic Generics –?Python supports type hints, which now include include TypeVarTuple. When you are anticipating a particular array structure, this lets you define a placeholder for tuples, which is useful.
  • Independent Literal String Type –?Before, there was no method for type annotations to specify that a specific variable had to be a string defined in the source code. Linters can now test whether a variable is a string specified in the source code or a new string created using only strings stated in the source code using the new typing.LiteralString annotation.
  • TypedDict Required vs Missing Items –?The declaration of some keys as needed and others as potentially absent is not supported by TypedDict at this time. 3.11 adds Required() and notrequired() to give you a mechanism to take these into account.


Here is a detailed look at some of the major Python 3.11 features.

Let’s find out why there is so much talk in the market about the upcoming release of Python 3.11. Below mentioned are some of its crucial features that increase its value in the market.

  1. CPython Optimisation
  2. Better error messages
  3. Adding the new keyboard shortcut: Self
  4. Exception Notes
  5. Use except* to handle multiple exceptions
  6. Inclusion of A TOML Parser

CPython Optimisation

Python 3.11 is said to run 10–60% faster than Python 3.10 depending on the workload.

The standard version of the Python programming language is called CPython. The primary and most widely used Python interpreter is CPython, which was created in C and Python. The CPython interpreter is substantially more streamlined and swifter in version 3.11 compared to version 3.10. When constructed with GCC on Ubuntu Linux and tested using the performance benchmark set.

According to the documentation, the authors of Python 3.11 mainly concentrated on speedier startup and runtime.

Originally Published by https://www.inexture.com/the-python-3-11-release-everything-you-need-to-know/

要查看或添加评论,请登录

Dhruv Patel的更多文章

社区洞察

其他会员也浏览了