Re: Messing up with classes and their namespace

2009-06-06 Thread Dave Angel
Jean-Michel Pichavant wrote: div class=moz-text-flowed style=font-family: -moz-fixedScott David Daniels wrote: Jean-Michel Pichavant wrote: Hello world, I had recently a very nasty bug in my python application. The context is quite complex, but in the end the problem can be resume as

Messing up with classes and their namespace

2009-06-05 Thread Jean-Michel Pichavant
Hello world, I had recently a very nasty bug in my python application. The context is quite complex, but in the end the problem can be resume as follow: 2 files in the same directory : lib.py: import foo foo.Foo.BOOM='lib' foo.py: class Foo: BOOM = 'F' if __name__=='__main__':

Re: Messing up with classes and their namespace

2009-06-05 Thread Scott David Daniels
Jean-Michel Pichavant wrote: Hello world, I had recently a very nasty bug in my python application. The context is quite complex, but in the end the problem can be resume as follow: 2 files in the same directory : lib.py: import foo foo.Foo.BOOM='lib' foo.py: class Foo: BOOM =

Re: Messing up with classes and their namespace

2009-06-05 Thread Terry Reedy
Jean-Michel Pichavant wrote: Thanks for the explanation. I'll have to give it a second thought, I'm still missing something but I'll figure it out. Perhaps it is this: 1. When you run foo.py as a script, the interpreter creates module '__main__' by executing the code in foo.py. 2. When that