python - Get a subclass from a module -


i subclass sub class object api.py:

import inspect tm_base import base import tm_child  k, v in vars(tm_child).iteritems(): if inspect.isclass(v):     if (base in inspect.getmro(v) ,                 not inspect.isabstract(v)):         print v 

when running api.py both:

<class 'tm_child.sub'> <class 'tm_base.base'> 

and <class 'tm_child.sub'> only, why using not inspect.isabstract(v). not see wrong code..

here other files.

tm_base.py

from abc import abcmeta  class base(object):     __metaclass__ = abcmeta 

tm_child.py

from tm_base import base  class sub(base):     pass 

i've found it's not considered abstract class until has something:

class base:     __metaclass__ = abcmeta  print(isabstract(base)) #=> false  class base:     __metaclass__ = abcmeta      @abstractmethod     def method(self):         pass  print(isabstract(base)) #=> true 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -