<div class="gmail_quote">On Tue, Mar 13, 2012 at 5:20 PM, Nick Coghlan <span dir="ltr">&lt;<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><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.<br>
</p></div></blockquote><div>I&#39;m repeating myself now, but if we are preferring explicit to implict, why can&#39;t we just put the marker in the script itself?  This is actually the tradeoff made in Perl and Java; you don&#39;t have to mark the directory as a package, but you *do* have to declare the package in the class/module file.</div>
<div><br></div><div>What&#39;s more, that explicit declaration could be in the form of a library call that implements the actual sys.path manipulation -- neatly solving the performance question and avoiding the need to build the logic into the interpreter, all in one fell swoop.</div>
<div><br></div><div>(If somebody has already raised a killer objection to this proposal, sorry; I was not at PyCon.)</div><div><br></div></div>