Re: Hacking the scope to pieces

2005-05-24 Thread gry
Hugh Macdonald wrote: > We're starting to version a number of our python modules here, and I've > written a small function that assists with loading the versioned > modules... > > A module would be called something like: myModule_1_0.py > > In anything that uses it, though, we want to be able to r

Re: Hacking the scope to pieces

2005-05-24 Thread Hugh Macdonald
Maybe I misunderstood what you meant, but I couldn't quite manage to get this one working My initial hopes about __import__() were that I could define it inside my new module (moduleLoader) and, when the module is imported, it could do stuff (like try to hold onto the vars() and globals() from

Re: Hacking the scope to pieces

2005-05-24 Thread Hugh Macdonald
I will take a look! Thanks Skip -- Hugh -- http://mail.python.org/mailman/listinfo/python-list

Re: Hacking the scope to pieces

2005-05-24 Thread Skip Montanaro
Hugh> What I'm after is a way of moduleLoader.loadModule working back up Hugh> the scope and placing the imported module in the main global Hugh> scope. Any idea how to do this? You want to write an import hook I think. I'd start with the docs for the __import__ builtin. Also, Googl

Hacking the scope to pieces

2005-05-24 Thread Hugh Macdonald
We're starting to version a number of our python modules here, and I've written a small function that assists with loading the versioned modules... A module would be called something like: myModule_1_0.py In anything that uses it, though, we want to be able to refer to it simply as 'myModule', wi