[issue19944] Make importlib.find_spec load packages as needed

Eric Snow report at bugs.python.org
Wed Dec 11 23:42:05 CET 2013


Eric Snow added the comment:

It looks like there are two concepts at play though:

1. side-effect-free vs. may-have-side-effects
2. just-find-the-spec-dangit vs. find-the-spec-relative-to-submodule-search-locations-I-already-know

In the case of #1, providing the path is just a means to an end.  In contrast, for #2 providing the path is the whole point and side effects are something to which you may not have given any thought (but you probably aren't expecting them).

In both cases, it still boils down to (module name -> module spec).  To me, handling both with a single function and a keyword-only "path" parameter seems sufficient, as long as people don't miss the fact that there are side effects in the default case.

The tricky part is that this is not a high-use API, so I'm trying not to think in terms of common case.  (I'm tempted to say things like "in the common case you just want the spec and you don't care about that other stuff".)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19944>
_______________________________________


More information about the Python-bugs-list mailing list