Getting started with NumPy
In Chapter 2, Python Programming Specificities, we stated that Python is a dynamically typed language. This means that the interpreter automatically detects the type of a variable at runtime, and this type can even change throughout the program. For example, you can do something like this in Python:
$ python >>> x = 1 >>> type(x) <class 'int'> >>> x = "hello" >>> type(x) <class 'str'>
The interpreter was able to determine the type of x
at each assignation.
Under the hood, the standard implementation of Python, CPython, is written in C. The C language is a compiled and statically typed language. This means that the nature of the variables is fixed at compile time, and they can't change during execution. Thus, in the Python implementation, a variable doesn't only consist in its value: it's actually a structure containing information about the variable, including...