1

I am printing type(int). Please explain me about this behaviour. thanks in advance.

print(type(int))
Ravi Singh
  • 307
  • 2
  • 13

2 Answers2

3

int IS a type name (class name), while 1 is an object of type int

And "int" would be a string.

Check:

type(1) is int
type(int) is type
type("int") is str
type(str) is type
type(type) is type

Some build-in types are int, str, float, list, set, dict... And yes, all those names by themselves are of type type

h4z3
  • 5,265
  • 1
  • 15
  • 29
2

int itself is a type

type(0)
#int

type(int)
#type

Your example is no different to

print(type(type(0)))
tomgalpin
  • 1,943
  • 1
  • 4
  • 12