Re: Doubley imported module caused devastating bug

2009-09-27 Thread Francis Carr
> I would like to propose that it be made impossible in the Python > source to import two instances of the same module. A fully-automatic solution is more difficult than it might seem at first: http://www.python.org/dev/peps/pep-0328/ But there is a simple code-discipline solution: never ever us

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Daniel Stutzbach
On Thu, Sep 24, 2009 at 2:51 PM, Ethan Furman 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 Stutz

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Terry Reedy
Zac Burns wrote: On Thu, Sep 24, 2009 at 1:38 PM, Carl Banks wrote: On Sep 24, 10:26 am, Zac Burns wrote: Currently it is possible to import a file of one path to more than one 'instance' of a module. One notable example is "import __init__" from a package. Seehttp://stackoverflow.com/questi

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Zac Burns
On Thu, Sep 24, 2009 at 1:38 PM, Carl Banks wrote: > On Sep 24, 10:26 am, Zac Burns wrote: >> Currently it is possible to import a file of one path to more than one >> 'instance' of a module. One notable example is "import __init__" from >> a package. >> Seehttp://stackoverflow.com/questions/436

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Carl Banks
On Sep 24, 10:26 am, Zac Burns wrote: > Currently it is possible to import a file of one path to more than one > 'instance' of a module. One notable example is "import __init__" from > a package. > Seehttp://stackoverflow.com/questions/436497/python-import-the-containin... > > This recently cause

Re: Doubley imported module caused devastating bug

2009-09-24 Thread Ethan Furman
Zac Burns wrote: Currently it is possible to import a file of one path to more than one 'instance' of a module. One notable example is "import __init__" from a package. See http://stackoverflow.com/questions/436497/python-import-the-containing-package This recently caused a devastating bug in s

Doubley imported module caused devastating bug

2009-09-24 Thread Zac Burns
Currently it is possible to import a file of one path to more than one 'instance' of a module. One notable example is "import __init__" from a package. See http://stackoverflow.com/questions/436497/python-import-the-containing-package This recently caused a devastating bug in some of my code. Wha