Python - Data Type Type Objects

Introduction

Each core type has a built-in name: dict, list, str, tuple, int, float, complex, bytes, type, set, and more.

For example, all of the following type tests are true:

Demo

type([1]) == type([])               # Compare to type of another list 
type([1]) == list                   # Compare to list type name 
isinstance([1], list)               # Test if list or customization thereof 
# w  ww . j a va 2s  . c  om
import types                        # types has names for other types 
def f(): pass 
print( type(f) == types.FunctionType  )

Result

Related Topic