Python 3.13 has been released with a slight delay in Home Stretch. The new interactive shell aims to improve comfort during development. Additionally, the global interpreter lock can now be disabled to allow multi-threaded applications to run more efficiently. Finally, the new version brings an experimental Just-in-Time compiler (JIT).
Advertisement
Release was originally scheduled for October 1, but performance issues with some workloads required finalization and one additional release candidate,
more flexible interactive shell
By default, Python 3.13 relies on a new interactive shell that emerged from the PyPy project and offers significantly more features than the previous one.
The new REPL (Read Eval Print Loop) allows to directly edit code blocks from multiple lines instead of navigating through the command history line by line. It is now more convenient to insert code blocks: F3 Activates “Paste Mode”, which pastes the entire content instead of viewing the content as finished, as was previously the case with empty lines.
button F2 Activates history browse mode, which displays selected characters. >>>
And ...
Removed so that the code can be copied directly. For greater clarity, the REPL now provides color syntax highlighting for hints and tracebacks by default.
Finally, some essential features are as follows help
And quit
Now integrated as direct commands. For example, typing ends exit
Shell, instead of showing error message as before, to exit exit()
-call function or Ctrl+Z Should be pressed.
If you want to use the old interactive shell instead of the new one or do so for backward compatibility reasons, you can do so using the environment variable PYTHON_BASIC_REPL
Activate.
Farewell to the (slow) global interpreter lock
In March, after much preparation and discussion, it was decided to introduce a flag in Python 3.13 to disable the Global Interpreter Lock (GIL). The purpose of the GIL is to guarantee thread safety by ensuring that only one thread is actively running at a time. However, Python cannot efficiently utilize the potential of multiprocessor systems or multi-core processors.
Python 3.13 now introduces so-called free-threaded mode, which works without a global interpreter lock. The mode is marked as experimental, and the description warns that bugs and significantly worse single-threaded performance are still expected.
For applications without GIL, an appropriate binary is available, which is part of the official installation package for Windows and macOS. The GIL can finally be set via environment variables PYTHON_GIL
or command line parameters -X gil=0
Deactivate.
experimental JIT compiler
The new just-in-time compiler is also considered experimental. By default, Python is an interpreted language: CPython does not translate source code into machine code, but only into bytecode, which the Python interpreter interprets at runtime. PEC files are a direct representation of the source code without bytecode optimization – unlike compiled languages like C++ or Rust.
python 3.13 Introduces a JIT compilerWhich compiles the code into machine code at runtime to improve performance. The pull request is on GitHub as of Christmas Day (December 25, 2023) Full of a nice, sappy Christmas poem.
Operating System and WebAssembly
The platform has also seen some notable developments: There are three phases of a CPython project (tiers) for operating systems with different requirements. With Python 3.13, mobile operating systems Android and iOS are considered official platforms at the lowest level, 3. WebAssembly is now in level 2 together with WASI (WebAssembly System Interface), but the combination with Emscripten is no longer available in the current release.
with current release The official support period for annual Python releases has been extended: Starting with Python 3.13, releases receive two years of full support, followed by three years of security fixes. Previously, support was valid for one and a half years and then for three and a half years before security fixes were implemented.
further innovations such as adjustments locals()
-Made in Python documentation can be found in,
(rme)