On Tue, Jul 13, 2010 at 10:37 AM, Alexander Belopolsky
<[email protected]> wrote:
> In my experiments, 0 is not equivalent to None:
>
>>>> import sys, time
>>>> sys.modules['time'] = 0
>>>> __import__('time')
> 0
>>>> sys.modules['time'] = None
>>>> __import__('time')
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named time
>
>  Am I missing something?

I don't think so. I suspect I got away with this mistake because the
imports I was trying to block in the test suite were all C
acceleration imports of the form "from <module> import *", and those
will blow up anyway since zero doesn't have __dict__ or __all__
attributes.

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to