Question #935

issubclass() can accept class instances as attributes.

issubclass() only accepts classes as attributes, not classes instances. This will work:


class MyDict(dict):
    pass

print(issubclass(MyDict, dict))

However, this will throw a TypeError exception:

class MyDict(dict):
    pass

my_dict = MyDict()
a_dict = dict()

print(issubclass(my_dict, a_dict))



(programiz.com/python-programming/methods/built-in/issubclass)


Comment on Disqus:

Question difficulty: πŸ”΅πŸ”΅πŸ”΅πŸ”΅πŸ”΅