This repository contains sample code and data files that demonstrate some of the new features in Python 3.13.
You need Python 3.13 installed to run these examples. See the following tutorial instructions:
Note that for testing the free-threading and JIT features, you'll need to build Python from source code with additional compiler flags enabled, as explained in the tutorial. Alternatively, you can run benchmarks using Docker containers as explained below.
You can learn more about Python 3.13's new features in the following Real Python tutorials:
- Python 3.13: Cool New Features for You to Try
- Python 3.13 Preview: Free Threading and a JIT Compiler
- Python 3.13 Preview: A Modern REPL
You'll find examples from these tutorials in this repository.
This section only contains brief instructions on how you can run the examples. See the tutorials for technical details.
The following examples are used to demonstrate different features of the new REPL:
Run the scripts in the errors/
folder to see different error messages produced by Python 3.13.
You need to enable a few build options to try out the free-threading and JIT features in Python 3.13. You can find more information in the dedicated README file.
Run the scripts in the typing/
folder to try out the new static typing features.
The following scripts illustrate other new features in Python 3.13:
replace.py
: Usecopy.replace()
to update immutable data structures.paths.py
andmusic/
: Glob patterns are more consistent.docstrings.py
: Common leading whitespace in docstrings is stripped.
- Bartosz Zaczyński, E-mail: bartosz@realpython.com
- Geir Arne Hjelle, E-mail: geirarne@realpython.com
Distributed under the MIT license. See LICENSE
for more information.