[Python-ideas] descriptors outside of classes

Michael Foord fuzzyman at gmail.com
Thu Mar 31 00:04:06 CEST 2011

On 30 March 2011 22:13, Greg Ewing <greg.ewing at 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


> 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 at python.org
> http://mail.python.org/mailman/listinfo/python-ideas



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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110330/0dc27645/attachment.html>

More information about the Python-ideas mailing list