Python 3.13 Brings Optimizations, JIT Compiler and Better Error Messages


Python 3.13 is here and it brings some great new features and improvements! Let's dive into the highlights:


JIT Compiler for Faster Performance

One of the biggest additions is an experimental just-in-time (JIT) compiler. When enabled, the JIT can provide some nice performance boosts by translating Python bytecode to machine code at runtime. The performance gains are modest for now, but this lays the groundwork for further JIT optimizations in future releases.


To enable the JIT, you'll need to build Python with the --enable-experimental-jit configure option. The JIT architecture has multiple tiers for optimization - it will be exciting to see how this evolves.


Better Error Messages

Python 3.13 continues improving on Python's already excellent error messages. A few nice enhancements:

  •  Error tracebacks are now colorized by default for better visibility (controllable via environment variables).
  •  When a function is called with an incorrect keyword argument, Python will try to suggest the correct argument name.

"better error messages!".split(max_split=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    "better error messages!".split(max_split=1)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
TypeError: split() got an unexpected keyword argument 'max_split'. Did you mean 'maxsplit'?

This makes debugging code even easier, especially for newcomers to Python.


Dead Batteries Removed

Following the philosophy of keeping the core Python lean, Python 3.13 removes 19 little-used modules from the standard library per PEP 594. This "removes dead batteries" by deprecating legacy modules like aifc, cgi, nntplib, utils, xdrlib and more.

Other Improvements:

  •  New typing features like typing.TypeIs for more intuitive type narrowing
  •  Optimizations like faster textwrap.indent() and subprocess using posix_spawn() more often
  •  New functions/methods in various modules like PyDict_SetDefaultRef()


Python 3.13 proves that while Python continues maturing, it still has room for cool improvements and optimizations! The JIT compiler is definitely the biggest spotlight feature. Between performance work, better errors, and cleaning up the standard library, Python 3.13 is a nice evolutionary step.

Source - Python Website