Type() function in Python

Just know type is a metaclass, like a patern for all class and defined hineritances. Asking the “type” of an object is like asking from what type he is hinerited.
After, it’s quite easy, just ask you what is in the parentheses.

  • In the 1st, it’s an element of classe try1, it’s like when you write:
    a = try1()
    type(a)
  • In the 2nd it’s the class, which is inherited from type, like all class:
    type(int) → type
  • In the 3rd, like we sew before, it’s the class type, which is also a class, so doing like others:
    type(type) → type
  • for third it’s the same

image

type(thing) is like int(thing)