Data types

Python has several built-in data types, such as Numbers (integers, floating point numbers, complex numbers), strings, Lists, Tuples, Dictionaries, Sets and Files. These data types can be manipulated using language operators, built-in functions, library functions or a data type’s own methods.

You can also define your own classes and create your own class instances. For these class instances, you can define methods as well as manipulate them using the language operators and built-in functions for which you have defined the appropriate special method attributes.

Note

In the Python documentation and in this book, the term object is used for instances of any Python data type, not just what many other languages would call class instances. This is because all Python objects are instances of one class or another.

Python has several built-in data types, from scalars like numbers and boolean values to more complex structures like lists, dictionaries and files.