t251.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. class A: pass
  2. class B: pass
  3. class C: pass
  4. class D(A): pass
  5. class E(A,B): pass
  6. class F(E,C): pass
  7. a,b,c,d,e,f = A(),B(),C(),D(),E(),F()
  8. print isinstance(a, A)
  9. print isinstance(a, B)
  10. print isinstance(a, C)
  11. print isinstance(a, D)
  12. print isinstance(a, E)
  13. print isinstance(a, F)
  14. print "---"
  15. print isinstance(b, A)
  16. print isinstance(b, B)
  17. print isinstance(b, C)
  18. print isinstance(b, D)
  19. print isinstance(b, E)
  20. print isinstance(b, F)
  21. print "---"
  22. print isinstance(c, A)
  23. print isinstance(c, B)
  24. print isinstance(c, C)
  25. print isinstance(c, D)
  26. print isinstance(c, E)
  27. print isinstance(c, F)
  28. print "---"
  29. print isinstance(d, A)
  30. print isinstance(d, B)
  31. print isinstance(d, C)
  32. print isinstance(d, D)
  33. print isinstance(d, E)
  34. print isinstance(d, F)
  35. print "---"
  36. print isinstance(e, A)
  37. print isinstance(e, B)
  38. print isinstance(e, C)
  39. print isinstance(e, D)
  40. print isinstance(e, E)
  41. print isinstance(e, F)
  42. print "---"
  43. print isinstance(f, A)
  44. print isinstance(f, B)
  45. print isinstance(f, C)
  46. print isinstance(f, D)
  47. print isinstance(f, E)
  48. print isinstance(f, F)
  49. print "---"