Python - Data Type Type Objects


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:


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 
#   ww w . ja v a2 s  .c o  m
import types                        # types has names for other types 
def f(): pass 
print( type(f) == types.FunctionType  )


Related Topic