Python 3.11
The Self type is a new addition to Python's type hinting system. It allows you to indicate that a method returns an instance of the same class it's defined in.
The most significant headline of Python 3.11 was its speed. Through the , the version achieved an average speed increase of 25% to 60% over Python 3.10. python 3.11
async def risky_task(name, fail): await sleep(0.1) if fail: raise ValueError(f"name failed") return name The Self type is a new addition to
If you are starting a new project today, target . Your future self will thank you for the speed and clarity. Through the , the version achieved an average
This is transformative for complex comprehensions, nested function calls, and lambda expressions.
: Inspired by libraries like Trio, asyncio.TaskGroup provides a cleaner, safer way to manage multiple asynchronous tasks. 4. Advanced Static Typing