Playing with modules

Kent Johnson kent at kentsjohnson.com
Sat Feb 25 09:20:46 EST 2006


jjcassidy at gmail.com wrote:
>>You're going to have to create the home.base module somewhere. If you
>>want to put in that some code that basically imports another module's
>>namespace into the home.base module's namespace, then that may do what
>>you want.
> 
> 
> Thanks, Jonathon, but I think I've tried what you are saying. I've
> tried doing this a couple different ways.

What did you try? You should be able to write home/__init__.py to import 
whatever parts of cassidy.blah... you like and define the name base to 
be a reference to some part of cassidy.

> 
> But I was wondering whether I could fool or "backend" the normal import
> mechanism. Even in Java, I can write my own class loader which can
> quick compile Java snippets and load the anonymous byte code.

See http://www.python.org/doc/2.3/whatsnew/section-pep302.html

Kent



More information about the Python-list mailing list