Tips And Tricks For Working With Types

  • The builtin function type gives you the type of an object:

      >>> type(1)
      <class 'int'>
    
  • The builtin function isinstance returns whether your object is of some type:

      >>> isinstance(1, bool)
      False