In any OOP language, there are many different data types. In Python, number data types are used to store numeric values. There are four different numerical types in Python:
- int (plain integers): this one is pretty standard — plain integers are just positive or negative whole numbers.
- long (long integers): long integers are integers of infinite size. They look just like plain integers except they’re followed by the letter “L” (ex: 150L).
- float (floating point real values): floats represent real numbers, but are written with decimal points (or scientific notaion) to divide the whole number into fractional parts.
- complex (complex numbers): represented by the formula a + bJ, where a and b are floats, and J is the square root of -1 (the result of which is an imaginary number). Complex numbers are used sparingly in Python.
Applying the function call operator () to a numeric type creates an instance of that type. For example: calling int(x) will convert x to a plain integer. This can also be used with the long, float, and complex types.