1709broderick
HomeCoupon Codes and DealsWelcome to Python 3.11, an update to address the speed issue for...

Welcome to Python 3.11, an update to address the speed issue for decades

Python

Python 3.11 is up to 10-60% faster than Python 3.10. On average, developers measured an acceleration of 1.25 times the standard benchmark suite.

Python is incredibly popular because it is easy to learn, versatile, and has thousands of useful libraries for data science. But one thing is not as fast. This is about to change in Python 3.11, which is currently in the first beta phase of its preview (version 3.11.0b1) before its stable release later this year. It is one of the most anticipated versions. “Python 3.11 is up to 10-60% faster than Python 3.10,” said the release notes.

How do you do that? Python 3.11 is the first version to benefit from a project called Faster CPython, where CPython is the standard version of the interpreter. Faster CPython is a Microsoft-funded project whose members include Python inventor Guido van Rossum, senior Microsoft software engineer Eric Snow and Mark Shannon - who is under contract with Microsoft as the project’s technology leader.

A session scheduled for the EuroPython event in Dublin in July focuses on some of the changes that will accelerate. Shannon will describe the “adaptive specialization interpreter” in Python 3.11, which is PEP (Python Enhancement Proposal) 659. This describes a technique called specialization which, Shannon explains, “is usually done in the context of a JIT. [just in time] compiler, but research shows that specialization in a performer can significantly increase performance. ”

The interpreter identifies the code that can benefit from the specialization and “once an instruction in a code object has been executed many times, that instruction will be“ specialized ”by replacing it with a new instruction that is expected to be executed faster for that operation “, says PEP. The speed can be “up to 50 percent”.

New features
  • Improved tracking error locations
  • When printing tracebacks, the interpreter will now indicate the exact expression that caused the error instead of just the line.
E.g:

Traceback (most recent call last):

The distance.py file, line 11, in

print (distant_manhattan (p1, p2))

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

“Distance.py” file, line 6, in manhattan_distance

return abs (point_1.x - point_2.x) + abs (point_1.y - point_2.y)

^^^^^^^^^^

AttributeError: “NoneType” object does not have the “x” attribute

Earlier versions of the interpreter would only indicate the line, which makes the object that was None ambiguous. These enhanced errors can also be useful when dealing with deeply nested dictionary objects and multiple function calls.

Traceback (most recent call last):

“Query.py” file, line 37, in

magic_arithmetic (‘foo’)

^^^^^^^^^^^^^^^^^^^^^^^^^

File “query.py”, line 18, in magic_arithmetic

returns add_counts (x) / 25

^^^^^^^^^^^^^^

File “query.py”, line 24, in add_counts

returns 25 + query_user (user1) + query_user (user2)

^^^^^^^^^^^^^^^^^^^

The query.py file, line 32, in query_user

returns 1 + query_count (db, reply[‘a’][‘b’][‘c’][‘user’]retry = True)

~~~~~~~~~~~~~~~~~~~~^^^^^^^^

  • TypeError: The “NoneType” object is not writable, as are complex arithmetic expressions:

Traceback (most recent call last):

“Calculation.py” file, line 54, in

result = (x / y / z) * (a / b / c)

~~~~~~ ^ ~~

ZeroDivisionError: Zero division

  • New syntax features:

PEP 654: Exceptional groups and with the exception *. (Contribution by Irit Katriel to bpo-45292.)

New typing features:

PEP 646: Generic Variations.

PEP 655: Mark individual TypedDict items as needed or missing.

PEP 673: Own type.

PEP 675: Arbitrary literal string type.

Security enhancements:

The new -P command line option and PYTHONSAFEPATH environment variable to avoid adding a potentially unsafe path to sys.path, such as the current directory, script directory, or empty string.

Other additions, fixes, and changes to Python 3.11

Many minor improvements have also been made in Python 3.11:

  • Python objects require less memory, as their namespaces are now lazily created, and their namespaces dictionaries now share keys whenever possible
  • Dictionaries where all keys are Unicode no longer need to store hashes, thus reducing the size of the dictionary and enabling more efficient caching
  • CPython Runtime, the reference interpreter for Python, now has experimental support for compilation in WebAssembly. This can help the future development of projects such as PyScript, which allow a Python runtime compiled by WASM to run in the browser.

Posting Welcome to Python 3.11, an update to combat a decades-long speed issue first appeared on.

Dedicated Server
Dedicated Serverhttps://www.winteringhamfields.com
Hi, By Profession I am an Injury Attorney who handles accident cases of cars with no insurance. I took College Classes online to get a degree in game design too.
RELATED ARTICLES

Most Popular

Recent Comments