[Python-Dev] Sneaky 'super' instances

Raymond Hettinger python@rcn.com
Wed, 11 Jun 2003 18:12:52 -0400


[Raymond]
> > That is a reasonable short-term solution but it should go 
> > one layer down in ismethoddescriptor().  Append the line:
> > 
> >     and not isinstance(object, super)
> >

[Brett]
> Even though it is a non-data descriptor?  It seems to have a __get__ 
> instead of a __call__ method.  The problem is that pydoc just classifies 
> it as a descriptor first and assumes __name__ will be there.

Either way is fine.

My way solves the original problem and defines methoddescriptor
as a non-data descriptor that isn't super.  I think that matches what 
people expect when calling that inspect.ismethoddescriptor().

OTOH, if methoddescriptor is viewed as synonymous with
non-data descriptor, then, technically a super object should
return True and your fix will have to go inspect.isroutine().

Name your poison.  Add a test case.  Then fix it.


Raymond