26.6. Data Types and Variables
Python uses dynamic data typing. This means that the Python compiler doesn't assign a type to the objects that it uses. The virtual machine instead does the assignment at run-time. This adds a great deal of flexibility to Python, but it can also create errors that are difficult to find. For example, if a typographical error is made when typing the variable name, it will be recognized as a new variable, which may not be immediately obvious to the person executing the code.
26.6.1. Data Types
Python supports the following five types of data:
Python supports four numerical types:
int (signed integers)—Most 32-bit computers will offer an integer range from −231 to 231-1 (−2,147,483,648 to 2,147,483,647).
long (long integers)—The range of Python longs are limited only by the amount of virtual memory a system has. Longs may be represented in decimal, octal, or hexadecimal notation. As in most other languages, long integers in decimal form are denoted by an uppercase L or a lowercase l. Some examples follow:
float (floating-point real values)—Floating-point numbers in Python are denoted by a decimal point and either a lowercase e or an uppercase E and a positive (+) or negative (-) sign. Examples follow:
complex (complex numbers)—Complex numbers have real and imaginary components. Complex number attributes are accessible like this: