Release Date: September 29, 2012
Key Focus: Syntax simplification (yield from), Environment Isolation (venv), Network IP handling (ipaddress), and CPython internal optimizations.
Allows a generator to delegate part of its operations to another generator.
- Simplifies nested generator code significantly.
- Supports returning values from sub-generators.
Introduced the venv module natively into the Python standard library, enabling lightweight virtual environments without needing third-party tools like virtualenv.
Added the ipaddress module to inspect, validate, and manipulate IP addresses, subnets, and networks seamlessly.
Directories without an __init__.py file can now be imported as Python namespace packages across multiple directories or sys.path locations.
Restored u'string' literal syntax to ease migration of legacy Python 2 codebases to Python 3.
Provides a read-only dynamic proxy view of a dictionary to prevent modification of protected mappings.
| PEP | Feature | Description |
|---|---|---|
| PEP 380 | yield from |
Generator delegation syntax |
| PEP 405 | venv module |
Built-in virtual environment support |
| PEP 3144 | ipaddress module |
IP address & network manipulation |
| PEP 420 | Namespace Packages | Directories without __init__.py as packages |
| PEP 393 | Flexible String Representation | Compact internal unicode representation (saves memory) |
| PEP 415 | faulthandler |
Dump C tracebacks on crash/segfault |
Check main_3_3.py in this directory for runnable code examples demonstrating:
- Delegating generators with
yield from - Working with
ipaddress.ip_networkandipaddress.ip_address - Using
types.MappingProxyTypefor immutable dict views - Locating system executables with
shutil.which