From Python 3 onwards, every class by default is an instance of the type
class.
>>> class A:
... pass
...
>>> isinstance(A, type)
True
Some more playing around if that’s your thing:
>>> type(A)
<class 'type'>
>>> type.__bases__
(<class 'object'>,)
>>> type(object)
<class 'type'>
>>> issubclass(A, type)
False
I discovered this while reading through a Django snippet and re-writing some Python 2 code into Python 3. Who knew reading code helps you learn?
0