<p><br>
On Mar 14, 2012 6:25 AM, &quot;Eric Snow&quot; &lt;<a href="mailto:ericsnowcurrently@gmail.com">ericsnowcurrently@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Here&#39;s one idea to address the PEP 395 concern.<br>
&gt;<br>
&gt; Traverse up the directory tree until you hit one of the following three markers:<br>
&gt;<br>
&gt; * there is no __init__.py in the current directory (in the case where<br>
&gt; there was one adjacent to the original module)<br>
&gt; * current directory is on sys.path<br>
&gt; * setup.py is in the current directory<br>
&gt;<br>
&gt; All these indicate that you have left the package.  If you make it to<br>
&gt; the FS root, the module would not be considered to exist in a package.<br>
&gt;<br>
&gt; The third option is the new idea.  As a bonus, using setup.py as a<br>
&gt; marker would also nudge people toward packaging.<br>
&gt;<br>
&gt; -eric</p>
<p>Alas, that doesn&#39;t work - to avoid slowing down normal startup too much, there needs to be a *fast* check that tells the interpreter immediately whether or not it is inside a package and needs to search the filesystem for the parent of the package directory. That&#39;s only possible when each package directory has an explicit marker.</p>

<p>Instead, I&#39;ll have to put the search in importlib so the import error message can tell the user which directory to switch to and what &quot;python -m&quot; command to use to run their module. I do like the idea of using <a href="http://setup.py/cfg">setup.py/cfg</a> as an extra marker, though. </p>

<p>I&#39;ll be moving house over the next few days and only have mobile internet at home for a while after that, so I&#39;ll probably revise PEP 395 some time after the next 3.3 alpha.</p>
<p>Cheers,<br>
Nick.</p>
<p>--<br>
Sent from my phone, thus the relative brevity :) </p>