Introspection in python 🕵🏽

Introspection in python is very interesting and it can help debug in various situation. Introspecting type information. We can use type function to check the type of python object. In the example below we assign 7 to variable val. And as we see type of val is class int. We can further check what is the type of int and surprise surprise it is of class type. val = 7 print(type(val)) print(type(int)) <class 'int'> <class 'type'> We can do a similar introspection with a class object....

August 5, 2020 · 4 min · Me