N
Nathan Bullock
Okay I have two files:
a.py:
-----
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)
-----
and b.py:
-----
from a import cla_a
class cla_b(cla_a): pass
-----
now if I do 'python a.py'
it gives me:
False
True
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
http://bullock.mooo.com
a.py:
-----
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)
-----
and b.py:
-----
from a import cla_a
class cla_b(cla_a): pass
-----
now if I do 'python a.py'
it gives me:
False
True
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
http://bullock.mooo.com