I suppose that is more specific than the __import__ builtin.  Classes have __build_class__.  Functions don't have an equivalent in the global builtins.  

For imports you have to go through __import__.  So a __module_class__ would dictate which class for import to use.  By default it would be types.ModuleType.  Makes sense.

-eric

p.s. a __build_function__ would be meaningful addition particularly if the def-from syntax were feasible.  I'm just saying... :)

On Wed, Mar 30, 2011 at 3:13 PM, 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, 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