I suppose that is more specific than the __import__ builtin.  Classes have __build_class__.  Functions don't have an equivalent in the global builtins.  <div><br></div><div>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.</div>
<div><br></div><div>-eric</div><div><br></div><div>p.s. a __build_function__ would be meaningful addition particularly if the def-from syntax were feasible.  I'm just saying... :)</div><div><br><div class="gmail_quote">
On Wed, Mar 30, 2011 at 3:13 PM, Greg Ewing <span dir="ltr"><<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Eric Snow wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I was just thinking along those same lines.  Sounds like twisted already does it.  Does it amount to using a custom __import__?<br>
</blockquote>
<br></div>
I don't know what Twisted does, but I was thinking of<br>
an attribute called __moduleclass__ that works a bit<br>
like the old __metaclass__ attribute.<br>
<br>
Then you could do<br>
<br>
class __moduleclass__:<br>
<br>
   ... descriptor definitions go here ...<div><div></div><div class="h5"><br>
<br>
-- <br>
Greg<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br></div>