On 26 January 2014 11:57, Eric Snow <ericsnowcurren...@gmail.com> wrote:
> On Sat, Jan 25, 2014 at 6:28 PM, Antoine Pitrou <solip...@pitrou.net> wrote:
>> Is there a reason to have separate "importlib" (toplevel) and
>> "importlib.util" namespaces?
>
> As to why they are separate, you'll need to ask Brett.  I believe it's
> meant to keep the top namespace as small as possible.

Correct - the top level namespace is meant for people to use normally
for dynamic imports, reloading modules and clearing the internal
caches when dynamically creating modules.

By contrast, importlib.util is for when people are poking around at
import system internals more directly, writing custom importers and
loaders, replicating parts of the import system, etc. It's a "if you
don't know why you might want these operations, you probably don't
need them" kind of module, so we can keep the top level namespace
simple and relatively easy to learn.

find_loader()/find_spec() are both borderline as to which category
they fall into, but as Eric noted, there was a dependency issue in
this case which meant there were practical benefits to putting
find_spec() in the "import specialist" category.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to