I tried this in Python's REPL:
>>> class Foo:
... def f():{}
...
>>>
>>> type(Foo)
<type 'classobj'>
>>> Foo.__bases__
()
>>> type(type(Foo))
<type 'type'>
>>> type(Foo).__bases__
(<type 'object'>,)
However, I still can't figure out what "data type" means in OOP exactly.
In Python, I know that an instance can get its class by .__class__
and a class can get its parent class by .__bases__
. This seems easy to understand.
But what does the the type
of a "Class", or TypeObject
, mean? And what does the type
of a Type Object
mean? What does the __bases__
of a Type Object
mean? What is the difference between type
and class
in Python?
This looks a bit confusing to me.. Does anyone have ideas about this?