On Wed, May 23, 2012 at 8:24 PM, Eric V. Smith <e...@trueblade.com> wrote:
> I tried this approach and it works fine. The only caveat is that it > assumes that the parent path can always be computed as described above, > independent of what's passed in to PathFinder.load_module(). I think > that's reasonable, since load_module() itself hard-codes sys.path if the > supplied path is missing. > Technically, PEP 302 says that finders aren't allowed to assume their parent packages are imported: """ However, the find_module() method isn't necessarily always called during an actual import: meta tools that analyze import dependencies (such as freeze, Installer or py2exe) don't actually load modules, so a finder shouldn't *depend* on the parent package being available in sys.modules.""" OTOH, that's finders, and I think we're dealing with loaders here. Splitting hairs, perhaps, but at least it's in a good cause. ;-) I've checked this in to the pep-420 branch. I prefer this approach over > Nick's because it doesn't require any changes to any existing > interfaces. The changes are contained to the namespace package code and > don't affect other code in importlib. > > Assuming this approach is acceptable, I'm done with the PEP except for > adding some examples. > > And I'm done with the implementation except for adding tests and a few > small tweaks. > Yay!
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com