-1

python2.7

>>> issubclass(type,type)
True
>>> issubclass(object,object)
True
>>> issubclass(object,type)
False

I know that object is on the top of new-style class, so type is inherit from object . Since object is subclass of itself. Now I can get a chain like this: type --> object --> object -X-> type . How could issubclass(type,type) be True?

MMMMMCCLXXVII
  • 571
  • 1
  • 8
  • 23
  • I would recommend an excellent article on this topic: http://www.cafepy.com/article/python_types_and_objects/python_types_and_objects.html#bring-in-the-objects – ewcz Mar 07 '17 at 10:00
  • Also see http://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python – PM 2Ring Mar 07 '17 at 10:05

1 Answers1

3

As stated by Python documentation

A class is considered a subclass of itself

Carles Mitjans
  • 4,786
  • 3
  • 19
  • 38