Python 3.11 Released: Speed, Tracebacks, and Typing

·44m 54s
Shared point

Python 3.11: Major Features and Improvements

This episode of Python Bytes celebrates the official release of Python 3.11, marking a significant milestone in the language's development with critical focus on performance and debugging tools.

The Need for Speed

• A major theme for this release is performance improvement, with the language now running roughly 10% to 60% faster than version 3.10.
• Developers are seeing an average speedup of approximately 22% on standard benchmarks, which the hosts jokingly refer to as the return of the turbo button for computers.

Debugging and Tooling Enhancements

Fine-grained error locations: Tracebacks are now significantly more helpful, providing precise indicators (up to the exact character) showing where errors occur in complex nested expressions.
Exception Groups: The introduction of concepts to handle grouped exceptions improves asynchronous programming, allowing developers to manage multiple failures holistically.
TOML Support: The inclusion of tomllib as a standard library component simplifies working with pyproject.toml files, removing the need for external dependencies.

Typing Improvements

• The introduction of Self type hinting allows for better management of class methods returning instances of the class itself, especially useful in inheritance scenarios.
Literal String Types: New capabilities help prevent SQL injection vulnerabilities by distinguishing between safe, static literal strings and insecure dynamic input.

"Python 3.11 is up 10% to 60% faster than just 3.10... It's just a first down payment, but it's really great to see that happening."

Developer Best Practices

Installation Advice

Hosts advise against relying strictly on tools like Homebrew or PyEnv for beginners. Instead, they recommend the official installers from python.org, which provide a quick and reliable way to manage multiple coexisting versions without environment conflicts.

Ecosystem Updates

Textual 0.0.2: The latest release includes CSS-like styling capabilities, bringing modern web-like UI development to terminal applications.
Bossy Awards: The episode highlights several open-source tools, including WASM time for high-performance WebAssembly runtimes and PyScript for executing Python in the browser.
Motor/Beanie Fixes: Users of the Beanie project for MongoDB are advised to track package compatibility, as some async patterns have changed significantly in 3.11.

Topics

Chapters

9 chapters
Python Bytes
AI chat — answers grounded in episodes