Skip to content

type

In Python, a type represents the classification of a value or object, determining the kinds of operations that can be performed on it and the ways it can interact with other objects.

Types are essentially the blueprint or definition that specifies what an object is, such as an integer, string, list, or user-defined class.

Example

Here are a few examples of different types in Python. Note that you can use the built-in type() function to determine an object’s type:

Language: Python
>>> type(42)
<class 'int'>

>>> type("Alice")
<class 'str'>

>>> type([1, 2, 3])
<class 'list'>

>>> class Circle: pass
...
>>> type(Circle)
<class 'type'>

This code shows different Python types, including an integer (int), string (str), list, and user-defined class. To run the check, you use the type() function. Additionally, user-defined classes like Circle are themselves objects of the type class, highlighting Python’s nature where classes are first-class objects.

The Ultimate Guide to Python Type Checking

Course

Python Type Checking

In this course, you'll look at Python type checking. Traditionally, types have been handled by the Python interpreter in a flexible but implicit way. Recent versions of Python allow you to specify explicit type hints that can be used by different tools to help you develop your code more efficiently.

intermediate best-practices

For additional information on related topics, take a look at the following resources:

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Leodanis Pozo Ramos • Updated Oct. 13, 2026 • Reviewed by Dan Bader