type | Python Glossary – Real Python

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:

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.

Basic Data Types in Python

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