In order to understand the Python language, it helps to understand that everything in Python is an object, with an associated type. Some of those types might be built-in, representing simple and commonly used datatypes such as numbers (ints, floats, etc.) and strings. Others might be custom types developed through the use of object-oriented programming techniques to create new classes, representing new abstractions of data. Functions and modules are also objects in Python, each having their own appropriate type.

Class is a key concept from object-oriented programming (OOP). When we speak of a Python type or class, what we mean is:

Info: Python type or class meaning

A defined set of possible data attributes and the operations defined on them.

Every time we create a variable of a certain type, we have in fact created an object that is an instance of a certain class, in the same way that a certain pet named Frisky is an instance of the class of "cat". Accordingly, by knowing a variable's type, we know all the operations that are allowed on it. In OOP, these operations attached to a class (and thus to the objects that are instances of it) are generally referred to as its methods.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement