Question #191

What is the output of the code snippet below?
class Test1 (object):
class Test2 (Test1):
a = Test1()
b = Test2()
print(type(b) is Test1)

False! Even if the class Test2 inherits from the class Test1 , running the function type() on an instance of Test2 will not detect it. (

Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵