On 30 March 2011 22:13, Greg Ewing
<greg.ewing@canterbury.ac.nz> wrote:
Eric Snow wrote:
I was just thinking along those same lines. Sounds like twisted already does it. Does it amount to using a custom __import__?
I don't know what Twisted does,
I'm pretty sure it creates a module subclass that forwards all attribute access to the real module and inserts itself into sys.modules in place of the "real" module. Pretty evil really. :-)
I may be mistaken about this, it is based off my memory of a previous discussion.
Michael
but I was thinking of
an attribute called __moduleclass__ that works a bit
like the old __metaclass__ attribute.
Then you could do
class __moduleclass__:
... descriptor definitions go here ...