Module inspect Bug

T

Tomas Zulberti

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.
False

Its true that the condition nevertheless will be True on the if, but
the return value I think that should be boolean.

Thanks,
Tomas Zulberti

pd: Sorry for my bad English...
 
G

Gabriel Genellina

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.

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: http://bugs.python.org/issue7069
 
T

Tomas Zulberti

It would be nice ifinspect.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:http://bugs.python.org/issue7069

Thanks for the help... I wasn't using that the returned value was a
boolean, but the other methods returned a boolean, so I found that was
strange...

Thank you a lot,
Tomas Zulberti
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top