Web Analytics

Python type() Function

Built-in Function Introspection

The type() function either returns the type of the object or returns a new type object based on the arguments passed.

Syntax

type(object)
type(name, bases, dict)

Parameters

Parameter Description
object Required (if only one argument). The object whose type you want to get
name String. Proposed name for the class
bases Tuple. Base classes the new class inherits from
dict Dictionary. Namespace definition for the class

Return Value

Returns the type of the object (if one argument) or a new type object (if three arguments).

Example

Using the type() function:

Output
Click Run to execute your code

Related Functions