Module inspect Bug

Gabriel Genellina gagsl-py2 at
Tue Oct 6 06:36:28 CEST 2009

En Mon, 05 Oct 2009 11:59:01 -0300, Tomas Zulberti <tzulberti at>  

> Hi. I have a class that extends collections.MutableMapping. I am
> checking if it is abstract, using the module inspect. But isabstract
> returns a number different from zero insted of True or False. The
> problem with that is that sometimes it returns False when the class
> isn't an abstract.
>>>> inspect.isabstract(collections.MutableMapping)
> 1048576
>>>> inspect.isabstract(os)
> False
> Its true that the condition nevertheless will be True on the if, but
> the return value I think that should be boolean.

It would be nice if inspect.isabstract() returned True/False, but 1048576  
is as good as any other true value, ok? You should not rely on specific  
values, nor compare the result against True nor False directly.

Anyway, given that no other isXXX function behaves that way, and  
inspect.isgeneratorfunction() uses a similar construct but always returns  
True/False, I've submitted a bug+patch:

Gabriel Genellina

More information about the Python-list mailing list