In Python, enumerate() function is an improvement over regular iteration. The enumerate() function returns an iterator that gives (0, item).
E.g. >>> thelist=['a','b']
>>> for i,j in enumerate(thelist): ...
In Functional Programming, we decompose a program into functions. These functions take input and after processing give an output. The function does not maintain any state.
Python provides built-in functions that can be used for Functional programming. Some of these functions are:
Event iterators and generators can be used for Functional programming in Python.
We can create a common module with variables that we want to share.
This common module can be imported in all the modules in which we want to share the variables.
In this way, all the shared variables will be in one module and available for sharing with any new module as well.
Python provides a profiler called cProfile that can be used for profiling Python code.
We can call it from our code as well as from the interpreter.
It gives use the number of function calls as well as the total time taken to run the script.
We can even write the profile results to a file instead of standard out.