5.1 Number type
Numbers provide scalar storage and direct access. It is an immutable type, which means that changing the value of the number will create a new object. Of course, this process is transparent to both programmers and users, and does not affect the way software is developed. Python supports multiple number types: integer, long, boolean, double, decimal float, and complex numbers.
How to update a numerical object
Because you do not actually update the original value of the object. This is because numeric objects are immutable objects. Python's object model is somewhat different from the regular object model. What you think of as an update is actually creating a new numeric object and getting a reference to it.
In the process of learning programming, we have always been taught that a variable is like a box containing the value of the variable. In Python, a variable is more like a pointer pointing to a box that holds the variable's value. For immutable types, you cannot change the contents of the box, but you can point the pointer to a new box. Every time you assign another number to a variable, you actually create a new object and assign it to the variable. (This is true not just for numbers, but for all immutable types)
anInt += 1
aFloat = 2.718281828
How to delete a numerical object
According to Python’s rules, you cannot really delete a numerical object, you just no longer use it. If you
actually want to delete a reference to a numeric object, use the del statement (see Section 3.5.6). After deleting the reference to an object, you can no longer use the reference (variable name) unless you assign a new value to it. If you try to use an object reference that has been deleted, a NameError exception will be raised.
del anInt
del aLong, aFloat, aComplex
5.3 Double-precision floating-point numbers
0.0 -777. 1.6 -5.555567119 96e3 * 1.0
4.3e25 9.384e-23 -2.172818 float(12) 1.000000001
3.14 16 4.2E-10 -90. 6.022e23 -1.609E -19
5.4 Complex numbers
The following are several concepts about complex numbers in the Python language: