<br><div class="gmail_quote">On Fri, Jun 8, 2012 at 3:16 PM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us" target="_blank">ethan@stoneleaf.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Dan Stromberg wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Did the import semantics change in cpython 3.3a4?<br>
<br>
I used to be able to import treap.py even though I had a treap directory in my cwd.  With 3.3a4, I have to rename the treap directory to see treap.py.<br>
</blockquote>
<br></div>
Check out PEP 420 -- Implicit Namespace Packages [<a href="http://www.python.org/dev/peps/pep-0420/" target="_blank">http://www.python.org/dev/peps/pep-0420/</a>]<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote>
<div><br>Am I misinterpreting this?  It seems like according to the PEP, I should have still been able to import treap.py despite having a treap/.  But I couldn't; I had to rename treap/ to treap-dir/ first.<br><p style="margin-left:40px">
During import processing, the import machinery will continue to
iterate over each directory in the parent path as it does in Python
3.2.  While looking for a module or package named "foo", for each
directory in the parent path:</p>
<blockquote>
<ul style="margin-left:40px" class="simple"><li>If <tt class="docutils literal"><span class="pre"><directory>/foo/__init__.py</span></tt> is found, a regular package is
imported and returned.</li><li>If not, but <tt class="docutils literal"><span class="pre"><directory>/foo.{py,pyc,so,pyd}</span></tt> is found, a module
is imported and returned.  The exact list of extension varies by
platform and whether the -O flag is specified.  The list here is
representative.</li><li>If not, but <tt class="docutils literal"><span class="pre"><directory>/foo</span></tt> is found and is a directory, it is
recorded and the scan continues with the next directory in the
parent path.</li><li>Otherwise the scan continues with the next directory in the parent
path.</li></ul>
</blockquote>Thanks!<br><br></div></div>