<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2><FONT size=2>
<P>In his essay on type/class unification, Guido defines the following </P>
<P>autosuper metaclass:</P>
<P>--- begin autosup.py ---</P>
<P>class autosuper(type): #Guido's metaclass</P>
<P>def __init__(cls, name, bases, dic):</P>
<P>super(autosuper, cls).__init__(name, bases, dic)</P>
<P>setattr(cls,"_%s__super" % name, super(cls))</P>
<P>class C(object): #a simple class</P>
<P>__metaclass__=autosuper</P>
<P>--- end autosup.py ---</P>
<P>Notice that I have put the metaclass in a module called autosup.</P>
<P>Everything works as expected; however, there is some incompatibility </P>
<P>with pydoc:</P>
<P>>>> import autosup</P>
<P>>>> help(autosup)</P>
<P>Traceback (most recent call last):</P>
<P>File "<pyshell#1>", line 1, in ?</P>
<P>help(autosup)</P>
<P>File "C:\PYTHON22\lib\site.py", line 279, in __call__</P>
<P>return pydoc.help(*args, **kwds)</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 1510, in __call__</P>
<P>self.help(request)</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 1546, in help</P>
<P>else: doc(request, 'Help on %s:')</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 1341, in doc</P>
<P>pager(title % (desc + suffix) + '\n\n' + text.document(thing, name))</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 267, in document</P>
<P>if inspect.ismodule(object): return apply(self.docmodule, args)</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 961, in docmodule</P>
<P>contents.append(self.document(value, key, name))</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 268, in document</P>
<P>if inspect.isclass(object): return apply(self.docclass, args)</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 1093, in docclass</P>
<P>lambda t: t[1] == 'method')</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 1035, in spill</P>
<P>name, mod, object))</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 269, in document</P>
<P>if inspect.isroutine(object): return apply(self.docroutine, args)</P>
<P>File "C:\PYTHON22\lib\pydoc.py", line 1116, in docroutine</P>
<P>realname = object.__name__</P>
<P>AttributeError: 'super' object has no attribute '__name__'</P>
<P>Somebody can tell me what's happening, please ?</P>
<P>TIA,</P>
<P>Michele</P></FONT></FONT></DIV></BODY></HTML>