[Python-Dev] New Super PEP

Phillip J. Eby pje at telecommunity.com
Sun Apr 29 21:40:10 CEST 2007

At 01:19 PM 4/29/2007 -0400, Calvin Spealman wrote:
>Backward compatability of the super type API raises some issues. Names, the
>lookup of the __call__ of the super type itself, which means a conflict with
>doing an actual super lookup of the __call__ attribute. Namely, the following
>is ambiguous in the current proposal:
>     ::
>         super.__call__(arg)
>Which means the backward compatible API, which involves instansiating the 
>type, will either not be possible, because it will actually do a super lookup
>on the __call__ attribute, or there will be no way to perform a super 
>lookup on
>the __call__ attribute. Both seem unacceptable, so any suggestions are 

Note that if you have a class with a __call__ method, it will still be 
called, even if you override __getattribute__ to return something else when 
asked for the __call__ attribute, e.g.:

 >>> class DoubleCall(object):
...     def __call__(self):
...         return "called!"
...     def __getattribute__(self, attr):
...         if attr=='__call__':
...             return lambda: "attribute"

 >>> dc = DoubleCall()
 >>> dc()
 >>> dc.__call__()

More information about the Python-Dev mailing list