Python 3.15 introduces a native lazy imports mechanism via the new `lazy` keyword, allowing modules to be evaluated only when first used rather than at import time. This eliminates the need for clumsy workarounds like placing imports inside function bodies. The feature also includes programmatic control through `sys.set_lazy_imports()` to enable lazy loading globally or selectively, and `sys.set_lazy_imports_filter()` to define allow/block lists. Backward-compatible adoption patterns are provided for codebases that need to support older Python versions.
Sort: