
Python is an open-source programming language. What makes Python open-source is that it is constantly been upgraded by the Python community. The community comes up with exciting new upgrades and features in Python every year.
This is 2022 and this is the year of Python’s 3.11 version.
Python 3.11 has been officially launched on October 24.
New features and upgrades in Python 3.11

1. Python 3.11 is faster than Python 3.10
The community has well put in docs that Python 3.11 can be up to 60% faster than Python 3.10. Also, the benchmark suite runs up to 25% faster than in 3.10. This can be profitable to Python programmers and data scientists.
To run this benchmark test to compare the speeds of Python 3.10 and Python 3.11, you will need a docker installation on the system.
2. Exception Notes
Python 3.11 offers a new function called add_notes() to make the exceptions as expressive as possible. Any custom messages can be passed so that they will be displayed if any error will be raised.
Look at this code snippet:

On running, you can see your custom note has been displayed on the terminal

This feature is pretty useful in dealing with errors.
Talking about the error part, the next major upgrade Python 3.11 came with is explained in the next part.
3. More Expressive Error Messages
Python 3.11 has a new upgrade with the display of error messages. Previously, the interpreter would throw an error mentioning the line number and error description, but with this version, the ~ and ^ characters are added to specify where the error actually might be.
Take a previous example, Division by zero error.

The characters ~ and ^ stating the actual part of the error.
This feature makes debugging a lot easier.
4. New Modules in Python 3.11
a. TOML Support
The human-friendly and computer-friendly Tom’s Obvious Minimal Language has now been included in Python’s standard library tomllib. TOML provides metadata for projects and packages.
b. wsgiref.types
This module provides utilities for static type checking.
5. Upgradations to Standard Libraries
Most of the common and stand libraries of Python gone improved with Python 3.11.
- math library has been updated with functions for computing cube root and power of 2.
- datetime library contains functions for iso formats
- A new module fractions has also been added that let user can create fractions from strings.
- Libraries such as typing, os, functools, enum, SQLite, etc are upgraded with new features.
6. typing : self
In previous versions of Python, the function returning self-objects was a lot more confusing and almost impossible. But typing library in Python 3.11 includes a self that lets you return the instances of a class.
7. Typedict: Required and NotRequired
All the fields in the typedict used to be compulsory. But Python 3.11 introduces Required and NotRequired, which can mark if the item is mandatory or not.
class Movie(TypedDict):
title: str
year: NotRequired[int]
The title is a required parameter whereas the year is not.
Considering the examples,
m1: Movie = {"title": "Black Panther", "year": 2018}
m2: Movie = {"title": "Star Wars"}
m3: Movie = {"year": 2022}
object m1 and m2 will work fine but object m3 will throw an error.
Conclusion
These were some major upgrades in Python 3.11.
It is recommended to update Python with the latest version because 3.11 is faster, more expressive, and has static typing support, and TOML support.
For more detailed information about Python 3.11, visit here.
Installation of Python 3.11:
Python 3.11 is available to install on the official websites.
Check it out here.
Thank-you.
Also Read:
- Bakery Management System in Python | Class 12 Project
- SQLite | CRUD Operations in Python
- Event Management System Project in Python
- Ticket Booking and Management in Python
- Radha Krishna using Python Turtle
- Hostel Management System Project in Python
- Sales Management System Project in Python
- Bank Management System Project in C++
- Python Download File from URL | 4 Methods
- Python Programming Examples | Fundamental Programs in Python
- Python | Delete object of a class
- Python | Modify properties of objects
- Python classmethod
- Python | Create a class that takes 2 parameters, print both parameters
- Python | Create a class, create an object of the class, access, and print property value
- Python | Find the maximum element in a list using lambda and reduce()
- Python | filter numbers(that are not divisible by 3 and 4) from a list using lambda and filter()
- Python | lambda function that returns the maximum of 2 numbers
- Python | Convert all strings of a list to uppercase using lambda
- Python | Square numbers of a list using lambda
- Python | Reverse and convert a string to uppercase using lambda
- Python | Convert String to uppercase using lambda
- Python | Reverse a list using lambda
- Python | Calculator using lambda
- Python | Square of a number using lambda
- Python | Multiply numbers using lambda
- Python | lambda with None
- Python | lambda with pass statement
- Python | Add numbers using lambda
- Python | Print Namaste using lambda