[Python-Dev] Sneaky 'super' instances (original) (raw)

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