Skip to content

Commit f599f61

Browse files
committed
Better explain the lazy import filter
1 parent de2c532 commit f599f61

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

peps/pep-0810.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,14 @@ If the global lazy imports flag is set to "disabled", no *potentially lazy*
322322
import is ever imported lazily, and the behavior is equivalent to a regular
323323
import statement: the import is *eager* (as if the lazy keyword was not used).
324324

325-
For a *potentially lazy* import, the lazy imports filter (if set) is called
326-
with the name of the module doing the import, the name of the module being
327-
imported, and (if applicable) the fromlist. If the lazy import filter returns
328-
``True``, the *potentially lazy* import becomes a lazy import. Otherwise, the
329-
import is *not* lazy, and the normal (eager) import continues.
325+
Finally, the application may use a custom filter function on all *potentially
326+
lazy* imports to determine if they should be lazy or not.
327+
If a filter function is set, it will be called with the name of the module
328+
doing the import, the name of the module being imported, and (if applicable)
329+
the fromlist.
330+
An import remains lazy only if the filter function returns ``True``.
331+
332+
If no lazy import filter is set, all *potentially lazy* imports are lazy.
330333

331334
Lazy import mechanism
332335
---------------------

0 commit comments

Comments
 (0)