Skip to content

Commit 907366e

Browse files
committed
gh-148588: Use :term:iterable not 'sequence' for __lazy_modules__
1 parent c99c1a4 commit 907366e

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

Doc/reference/datamodel.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,9 +1124,9 @@ the following writable attributes:
11241124

11251125
.. attribute:: module.__lazy_modules__
11261126

1127-
An optional sequence of absolute module name strings. When defined at
1128-
module scope, any regular :keyword:`import` statement in that module whose
1129-
target module name appears in this sequence is treated as a
1127+
An optional :term:`iterable` of absolute module name strings. When defined
1128+
at module scope, any regular :keyword:`import` statement in that module whose
1129+
target module name appears in this iterable is treated as a
11301130
:ref:`lazy import <lazy-imports>`, as if the :keyword:`lazy` keyword had
11311131
been used. Imports inside functions, class bodies, or
11321132
:keyword:`try`/:keyword:`except`/:keyword:`finally` blocks are unaffected.

Doc/reference/simple_stmts.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,8 @@ Compatibility mode via ``__lazy_modules__``
930930

931931
As an alternative to using the :keyword:`lazy` keyword, a module can opt
932932
into lazy loading for specific imports by defining a module-level
933-
:attr:`~module.__lazy_modules__` variable. When present, it must be a
934-
sequence of absolute module name strings. Any regular (non-``lazy``)
933+
:attr:`~module.__lazy_modules__` variable. When present, it must be an
934+
:term:`iterable` of absolute module name strings. Any regular (non-``lazy``)
935935
:keyword:`import` statement at module scope whose target appears in
936936
:attr:`!__lazy_modules__` is treated as a lazy import, exactly as if the
937937
:keyword:`lazy` keyword had been used.

Doc/whatsnew/3.15.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ raise :exc:`SyntaxError`).
185185
For code that cannot use the ``lazy`` keyword directly (for example, when
186186
supporting Python versions older than 3.15 while still leveraging lazy
187187
imports on 3.15+), a module can define
188-
:attr:`~module.__lazy_modules__` as a sequence of absolute module name
189-
strings. Regular ``import`` statements for those modules are then treated
188+
:attr:`~module.__lazy_modules__` as an :term:`iterable` of absolute module
189+
name strings. Regular ``import`` statements for those modules are then treated
190190
as lazy, with the same semantics as the ``lazy`` keyword::
191191

192192
__lazy_modules__ = ["json", "pathlib"]

0 commit comments

Comments
 (0)