<br><br><div class="gmail_quote">On Tue, Jul 13, 2010 at 05:48, 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">On Tue, Jul 13, 2010 at 10:37 AM, Alexander Belopolsky<br>
&lt;<a href="mailto:alexander.belopolsky@gmail.com">alexander.belopolsky@gmail.com</a>&gt; wrote:<br>
&gt; In my experiments, 0 is not equivalent to None:<br>
&gt;<br>
&gt;&gt;&gt;&gt; import sys, time<br>
&gt;&gt;&gt;&gt; sys.modules[&#39;time&#39;] = 0<br>
&gt;&gt;&gt;&gt; __import__(&#39;time&#39;)<br>
&gt; 0<br>
&gt;&gt;&gt;&gt; sys.modules[&#39;time&#39;] = None<br>
&gt;&gt;&gt;&gt; __import__(&#39;time&#39;)<br>
&gt; Traceback (most recent call last):<br>
&gt;  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
&gt; ImportError: No module named time<br>
&gt;<br>
&gt;  Am I missing something?<br>
<br>
</div>I don&#39;t think so. I suspect I got away with this mistake because the<br>
imports I was trying to block in the test suite were all C<br>
acceleration imports of the form &quot;from &lt;module&gt; import *&quot;, and those<br>
will blow up anyway since zero doesn&#39;t have __dict__ or __all__<br>
attributes.<br></blockquote><div><br></div><div>Nick&#39;s right; 0 fails on an import * to pull anything in of interest. And as I said on python-checkins -- you can ignore that email, Alexander -- there is a historical reason because in Python 2 if you tried an implicit relative import a value of None met to do an absolute import. This doesn&#39;t have that effect in py3k as explicit relative imports are the only way to do relative imports (and luckily importlib does the proper thing for this as well =).</div>

</div>