Skip to content

Commit f4a8366

Browse files
committed
gh-148588: Fix __lazy_modules__ use-case description
Replace 'migrating a large existing codebase' with the more accurate use case: supporting Python <3.15 while leveraging lazy imports on 3.15+.
1 parent 8891a25 commit f4a8366

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

Doc/reference/simple_stmts.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,9 @@ sequence of absolute module name strings. Any regular (non-``lazy``)
937937
:keyword:`lazy` keyword had been used.
938938

939939
This provides a way to enable lazy loading for specific dependencies without
940-
changing individual ``import`` statements — useful when migrating existing
941-
code or when the imports are generated programmatically::
940+
changing individual ``import`` statements — useful when supporting Python
941+
versions older than 3.15 while leveraging lazy imports on 3.15+, or when
942+
the imports are generated programmatically::
942943

943944
__lazy_modules__ = ["json", "pathlib"]
944945

Doc/whatsnew/3.15.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ function, class body, or ``try``/``except``/``finally`` block raises a
183183
raise :exc:`SyntaxError`).
184184

185185
For code that cannot use the ``lazy`` keyword directly — for example, when
186-
migrating a large existing codebase — a module can define
186+
supporting Python versions older than 3.15 while still leveraging lazy
187+
imports on 3.15+ — a module can define
187188
:attr:`~module.__lazy_modules__` as a sequence of absolute module name
188189
strings. Regular ``import`` statements for those modules are then treated
189190
as lazy, with the same semantics as the ``lazy`` keyword::

0 commit comments

Comments
 (0)