Python allows the definition of new data types that can do anything that the built-in types can do. From a user's point of view there is no difference. Python provides a set of standard operations that any data type can use if appropriate. These include arithmetic, indexing, function call, etc. In addition, data types can provide arbitrary operations in the form of methods .
Methods are like functions, but they depend on a specific data object.
There are many reasons for defining new data types. Type definitions also help to reduce the dependence between different parts of a program. So if the storage method is changed for some reason, other modules will not be affected. This technique is known as object-oriented programming . Python supports most of the techniques that are commonly used in object-oriented programming.