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 ...


--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas



--
http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html