Re: namespace query

2009-04-22 Thread Marco Mariani
Dr Mephesto wrote: ok, sorted. I had thought that when a module was imported, it was added to a larger shared namespace used by all the modules. Now, that would be awfulll Because one of the most important things about python (and the reason I can live without an IDE) is that I can point my

Re: namespace query

2009-04-22 Thread Dr Mephesto
ok, sorted. I had thought that when a module was imported, it was added to a larger shared namespace used by all the modules. And yes, you are all correct; the "global numpy" thing was an illusion caused by saving the file at the wrong time after making a few changes. -- http://mail.python.org/

Re: namespace query

2009-04-22 Thread Peter Otten
Dr Mephesto wrote: > I have a quick question about global namespace, and I'm hoping someone > could give a quick reply to sort me out :) > > I have a single file program that uses numpy, and it works just fine. > I want to move some classes into their own files, to make the code > reusable. When

Re: namespace query

2009-04-22 Thread Steven D'Aprano
On Wed, 22 Apr 2009 05:21:06 -0700, Dr Mephesto wrote: > If I add a "global numpy" to the beginning of each class in the new > files, the program runs. Do I really have to add "global XXX" for every > module I import in the main program into every module I create and > import? Why are the class fi

Re: namespace query

2009-04-22 Thread Marco Mariani
Dr Mephesto wrote: Why are the class files I created not seeing the top namespace? Because it's how python works. What you think is a top namespace, it's not "at the top". It's just the namespace of the module you run the program with. You must import numpy from the all the modules that make