Question #191

What is the output of the code snippet below?
class Test1 (object):
    pass
class Test2 (Test1):
    pass
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. (geeksforgeeks.org/python-type-function)


Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵