Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions peps/pep-0810.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1367,16 +1367,16 @@ The Python ``import`` machinery separates out finding a module and loading
it, and the lazy import implementation could technically defer only the
loading part. However:

- Finding the module does not guarantee the import will succeed, nor even
that it will not raise ImportError.
- Finding modules in packages requires that those packages are loaded, so
it would only help with lazy loading one level of a package hierarchy.
- Since "finding" attributes in modules *requires* loading them, this would
create a hard to explain difference between
``from package import module`` and ``from module import function``.
- A significant part of the performance win is skipping the finding part
(which may involve filesystem searches and consulting multiple importers
and meta-importers).
- Finding the module does not guarantee the import will succeed, nor even
that it will not raise ImportError.
- Finding modules in packages requires that those packages are loaded, so
it would only help with lazy loading one level of a package hierarchy.
- Since "finding" attributes in modules *requires* loading them, this would
create a hard to explain difference between
``from package import module`` and ``from module import function``.
- A significant part of the performance win is skipping the finding part
(which may involve filesystem searches and consulting multiple importers
and meta-importers).

Placing the ``lazy`` keyword in the middle of from imports
----------------------------------------------------------
Expand Down