How do you make issubclass work

Nathan Bullock nathan_kent_bullock at
Sat Sep 11 06:54:56 CEST 2004

Okay I have two files:
class cla_a(object): pass

class cla_c(object): pass

if __name__ == "__main__":
  mod = __import__("b")
  attr = getattr(mod, "cla_b")
  print issubclass(attr, cla_a)
  print issubclass(cla_c, cla_a)

from a import cla_a

class cla_b(cla_a): pass

now if I do 'python'
it gives me:

Why is cla_b a subclass and not cla_c?

I think that it has something to with the fact that cla_b is a
subclass of a different instance of cla_a or something like that. But
if that is the case how do I do this sort of thing in python?

Nathan Bullock

More information about the Python-list mailing list