[Python-Dev] Sneaky 'super' instances

Guido van Rossum guido@python.org
2003年6月10日 20:30:26 -0400


> Bug 729103 discovered an interesting little issue; 'super' instances 
> cause inspect.isroutine to return True since it also poses as a non-data 
> descriptor. Now this is bad because pydoc then tries to get a __name__ 
> attribute out of it which it lacks because it is an instance of a class 
> and not really a function or method.
>> So, should I change inspect.isroutine to check to see if its argument is 
> an instance of 'super'? Is there a robust way to check if something is 
> an instance of a class which could be used instead to make this more 
> general (like lacking a __name__ attribute)? Or do we just cause pydoc 
> to spit out "RTM online" every time it raises an error. =)

inspect shouldn't assume hat just because isroutine() returns true,
there has to be a __name__ attribue. Unfortunately, inspect is full
of such assumptions. :-)
--Guido van Rossum (home page: http://www.python.org/~guido/)

AltStyle によって変換されたページ (->オリジナル) /