On 1 December 2017 at 20:17, Steven D'Aprano <email@example.com> wrote:
> If that's what you mean, then no, I haven't wished for that. Unless I'm
> missing something, it seems pointless. When, and why, would I want to
> import an empty module?
Having access to something along these lines is the core building
block for lazy loading. You figure out everything you need to actually
load the module up front (so you still get an immediate ImportError if
the module doesn't even exist), but then defer actually finishing the
load to the first __getattr__ invocation (so if you never actually use
the module, you avoid any transitive imports, as well as any other
costs of initialising it).
Nick Coghlan | firstname.lastname@example.org | Brisbane, Australia
Python-ideas mailing list
Code of Conduct: http://python.org/psf/