Per-Interpreter GIL

Python is an interpreter language and has a Global Interpreter Lock (GIL) which prevents multiple threads to execute simultaneously. In Python 3.12 version, the the sub-interpreters have their own GLI which allows them to utilize the multiple CPU cores efficiently and thus, improve the performance.

Python 3.12 – What’s New and How to Download?

Python releases a new version almost every year. The latest version, that is, Python 3.12 was released on 2 October, 2023. This version introduced many new features and improvements. In this article, we will see some of the newly added features to Python 3.12.

Table of Content

  • Download and Install Python
  • Improved Error Messages in Python
  • More Flexibility in Python F-String
  • Type Parameter Syntax
  • Improvement in Modules
  • Syntactic Formalization of f-strings
  • Per-Interpreter GIL
  • Low Impact Monitoring for CPython
  • Conclusion

Similar Reads

Download and Install Python

To download and install Python, follow these steps based on your operating system:...

Improved Error Messages in Python

Python 3.12 brings several improvements to error messages, making them more precise and informative....

More Flexibility in Python F-String

Python 3.12 lifts some restrictions on f-strings, allowing for more flexibility in their usage....

Type Parameter Syntax

In the Python version below 3.12, type aliases, generic classes, and generic functions were declared using the TypeVar module. But Python 3.12 provides a cleaner and more concise code by declaring generic classes and functions without using the TypeVar module. It can be done by simply using the square brackets....

Improvement in Modules

Python 3.12, along with the addition of completely new features also introduced new functionalities and improved the performance of the existing modules. Let us see each module one by one....

Syntactic Formalization of f-strings

The new Python version has made the f-string more powerful by elimination a lot of ristriction on it. The formatted string, commonly known as f-string was originally introduced in Python version 3.6 for string formatting. The new version allows the f-string to include various valid Python expressions such as, multiline expressions, comments, backslashes, unicode characters, andquote reuse....

Per-Interpreter GIL

Python is an interpreter language and has a Global Interpreter Lock (GIL) which prevents multiple threads to execute simultaneously. In Python 3.12 version, the the sub-interpreters have their own GLI which allows them to utilize the multiple CPU cores efficiently and thus, improve the performance....

Low Impact Monitoring for CPython

Previously, sys.settrace was used by the Python debuggers for debugging and profiling purposes. But this method was less efficient, so in the new Python version, a new set of API for profilers, debuggers for monitoring the CPython events is introduced. This provides a better debugging and profiling capabilities while minimizing the performance impact....

Conclusion

These enhancements across various modules contribute to a more robust, efficient, and feature-rich Python ecosystem, catering to diverse development requirements and scenarios. Whether it’s improving debugging capabilities, enhancing filesystem operations, or refining database interactions, Python 3.12 offers a plethora of upgrades to empower developers in building robust and scalable applications....