Playing with modules
I know that this is not particularly "pythonic", but I would like to mess with modules a bit. I would like to develop a modular module which allows different services to plug themselves into the module and become the implementation for a named module. Say I have a suite of "cassidy.blah.blah.blah" modules. As it's not really my intention to brand everything, I want to remap all these modules as "home". Thus if someone (eventually) likes my code for x, but does not want the whole cassidy avalanche, and just wants something simple to do home.x, they can provide their own implementation or create a wrapper class to existing functionality which does the work. My problem is that this code fails all the time that I have tried to do this. import home.base Does anybody know of a way to "fool" python into thinking that my suite is actually this neutrally named suite called "home"? Thanks, John -- http://mail.python.org/mailman/listinfo/python-list
Re: Playing with modules
> 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. I suppose that what I could do is go somewhat explicit, and instead of trying to exploit the natural import language, create a method for this such as home.use('base') which could use even use the tracestack, get the current frame's globals and stick the entry { 'base': } into the currect scope and just make that part of the "API". 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. Thanks, John -- http://mail.python.org/mailman/listinfo/python-list
Re: Cheese Shop: some history for the new-comers
richard wrote: [snip] Should the "Python Cheeseshop" have anything in it, though? Having a stocked cheese shop in relation to Python is just silly! -- http://mail.python.org/mailman/listinfo/python-list