On 1 December 2017 at 20:17, Steven D'Aprano <[email protected]> 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).

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to