3.2 Why Python

Python is a programming language used for web development, scientific computing, and other fields.

Figure 1: TIOBE index (monthly) estimates relative popularity of programming languages using data on engineers, courses, vendors, and major search engines. It reflects popularity, not quality or total code written.

3.2.1 Disadvantages

Python is not without its drawbacks. Performance depends on the implementation and workload, and pure Python loops may be slower than equivalent compiled implementations in languages such as C or C++. However, Python can be optimized using libraries like NumPy and Cython, which implement performance-critical code in C. Also, there have been improvements in Python's performance over the years. Figure 2 illustrates the performance difference between Python and other programming languages using a simple example of nested loops.

Figure 2: 1 billion nested loops in different programming languages. A "loop" is a programming construct that allows you to repeat a block of code multiple times. In this example, repeating a simple block one billion times is used to compare the performance of different programming languages. The speed with which the ball completes the journey indicates the performance of each language. Notice how Python is significantly slower than other languages like C, C++, and Java. (Do not worry about this for now; Python allows for many optimizations that can significantly improve its performance.)

3.2.2 Python in the IEM program

In the IEM program, you will work with several MILP solvers, such as Gurobi and CPLEX, which have Python APIs. You will also use Python libraries like NumPy, Pandas, and Matplotlib for data analysis and visualization.