Python Forum

Full Version: Object and type class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, i'm a bit confused about type class and object class. I know that every normal class and built-in type are instance of type class and inherit from object class (is that correct? please correct me if i'm wrong). But when i try this:
print(isinstance(list,object))
It printed: True

Why is that? I thought object is the base class of list not the class which list was created from !. Can anybody show me the relationship between object class, type class, normal class, built-in type like list and string
All objects inherit from object. Testing objects against object should be always True, even if you check type against object.

The normal use is:
my_object = [1, 2, 3]
print(isinstance(my_object, list))
print(isinstance(my_object, tuple))
Output:
True False