Doubley imported module caused devastating bug

Daniel Stutzbach daniel at stutzbachenterprises.com
Thu Sep 24 19:44:13 EDT 2009


On Thu, Sep 24, 2009 at 2:51 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

> I believe that modules are imported only once
>

That's *mostly* true, but try this one:

A.py:
print 'Importing A'
import B

B.py:
print 'Importing B'
import A

Cashew:/tmp$ python2.5 B.py
Importing B
Importing A
Importing B

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090924/b35489c8/attachment.html>


More information about the Python-list mailing list