<br><br><div class="gmail_quote">On Thu, Apr 19, 2012 at 16:18, Eric V. Smith <span dir="ltr">&lt;<a href="mailto:eric@trueblade.com">eric@trueblade.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

This reflects (I hope!) the discussions at PyCon. My plan is to produce<br>
an implementation based on the importlib code, and then flush out pieces<br>
of the PEP.<br>
<br>
In particular, I want to make sure the PEP addresses the various<br>
objections that were raised, especially by Nick.<br></blockquote><div><br></div><div>Obviously thanks for writing this up, Eric! I have the following comments (some of which I would fix myself but I lack hg repo access ATM)  ...</div>

<div><br></div><div>In Terminology, can you put the terms when you define them in quotes, e.g. &#39;<span style>The term &quot;distribution&quot; refers to ...&#39;?</span></div><div><span style><br></span></div><div><span style>&quot;</span><span style>setuptools provides a similar function pkg_resources.declare_</span><span style>namespace&quot; should either have a &quot;named&quot; added in there or a comma.</span></div>

<div><span style><br></span></div><div><span style>&quot;</span><span style>As vendors might chose(sic) to&quot;.</span></div><div><span style><br></span></div><div><span style>You should mention that this will do away with the ImportWarning of discovering a directory lacking an __init__.py file.</span></div>

<div><font color="#222222" face="arial, sans-serif"><br></font></div><div><font color="#222222" face="arial, sans-serif">As for the effects on path hooks, there are none. =) It&#39;s actually the finders that they return which need to change. Either finders need to be updated to return something other than None to signal they have a directory which works for the name (maybe the string for what should go into __path__?) or another method on finders which is called if finder.find_module() returns None (like finder.find_namespace() which returns the directory name or None). Then you need to update importlib._bootstrap.PathFinder to handle one of the two approaches to create the module and set it with some __loader__ (which really doesn&#39;t need to do much more than construct a module with the proper attributes since there is nothing to execute) like importlib.machinery.NamespaceLoader(name, *paths). Using a specific class in import already has precedence thanks to NullImporter.</font></div>

<div><font color="#222222" face="arial, sans-serif"><br></font></div><div><font color="#222222" face="arial, sans-serif">If you want performance then you go with the returning of a string by finder.find_module() since the finder can keep track of finding a directory w/o an __init__.py when it tries looking for a module. Import can do a hasattr check on non-None return values to decide if it got back a loader or a path for a namespace. If you don&#39;t like what the return value to mean based on it being None or having a specific attribute then you would want the new method at the (potential) cost of another stat call. Or maybe someone can think of some other approach.</font></div>

</div>