New Features in Python 3.13: Updated REPL, GIL Removal, and Other Enhancements
The article introduces Python 3.13, explains how to install it via conda, and details major updates such as an improved interactive REPL, the optional removal of the Global Interpreter Lock, and a collection of miscellaneous language and tooling enhancements.
In early October 2024, Python 3.13 was released, bringing a host of new features and improvements.
1 conda Installation of the New Version
Using Miniconda, you can create a Python 3.13 environment named py13 :
<code>conda create -n py13 python=3.13</code>Activate the environment with:
<code>conda activate py13</code>2 Feature 1: New Interactive REPL
The updated REPL now supports multi‑line editing, block‑level history navigation with the up/down arrows, automatic indentation after the first line, and direct entry of exit and help without parentheses.
These changes simplify code editing and execution compared with previous versions where each line had to be entered or edited individually.
3 Feature 2: Optional Removal of the Global Interpreter Lock (GIL)
Python 3.13 introduces a “free‑threaded” mode that allows you to run Python without the GIL, enabling true multi‑threaded execution on multiple CPU cores. This is achieved by installing a special no‑GIL build and selecting the option during installation.
Executable files are typically named python3.13t , and you can enable or disable the GIL at runtime.
4 Other Notable Features
Docstring whitespace stripping reduces bytecode cache size.
Extended comment syntax now supports lambdas and comprehensions inside class scopes.
Future statements from __future__ no longer trigger automatically.
Global declarations are now allowed inside blocks.
New environment variable PYTHON_FROZEN_MODULES controls frozen module handling.
Performance analysis tool perf gains a no‑frame‑pointer mode via -X perf_jit .
Configurable history file location via PYTHON_HISTORY .
Classes now expose __static_attributes__ and __firstlineno__ .
exec() and eval() accept globals and locals keyword arguments.
The article concludes with a reminder to follow the public account for more Python learning resources.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.