Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python 3.12 version officially launched: f-string parsing improved, overall performance improved by 5%

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > IT Information >

Share

Shulou(Shulou.com)11/24 Report--

CTOnews.com, Oct. 6, Python 3.12 official version has been launched, improving many existing features, including f-string parsing improvements, Buffer Protocol (buffer protocol), etc., as well as improving error messages so that developers can better understand the cause of errors. In addition, the development team has also made a series of performance improvements, claiming that "the overall performance of this version has been improved by about 5%."

According to the ▲ source Python website, f-string parsing is more flexible in Python 3.12, and many operations that were previously not allowed are further relaxed in this version.

In 3.11, f-string expressions that reuse the same quotation marks of external f-string will lead to syntax errors, which is allowed in 3.12; in the previous version, the f-string expression itself had to be defined in a single line even though it could span multiple lines, and developers could use multi-line expressions in 3.12. Previously, f-string could not contain any backslash symbol "\", which is also allowed in the new version, so f-string can now also include escape sequences (Escape Sequences).

CTOnews.com found that Python developers can more easily use Buffer Protocol (buffer Protocol) in the new version, which is a lightweight and efficient structured data storage format. Using related protocols when dealing with a large number of data files can improve performance and save storage space.

Previously, Buffer Protocol was mainly used in Python's C API, which was not friendly to developers of pure Python. Python 3.12 introduced a new method to solve this problem, so that developers can operate related functions more directly in Python, without the need to use C # or other methods.

The error tips in version 3.12 of Python have also been improved to make it easier for developers to identify the cause of the error and make it easier to correct the error. When developers mistakenly use import syntax, the system provides correct advice, while when using incorrectly referenced instance properties in category methods, the error prompt now points to the property name of the correct project itself.

Python 3.12 has also made a number of performance improvements, and Unicode has been streamlined in this version to reduce the related space footprint and make it lighter, and Python will also use BOLT binary tools to improve the performance of related scenarios by 1% to 5% when building the environment.

Referenc

Python 3.12.0 (final) is here

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

IT Information

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report