Summary
Functional programming is a paradigm that scares many people initially, but really it shouldn’t. The most important difference between functional and procedural programming (within Python) is the mindset. Everything is executed using simple functions that depend only on their input variables and don’t produce any side effects outside of the local scope.
The main advantages are:
- Because there are fewer side-effects and code influencing each other, you will get fewer bugs.
- Because the functions always have a predictable input and output, they can be easily parallelized across multiple processors or even multiple machines.
This chapter covered the basics of functional programming within Python and a tiny portion of the mathematics behind it. In addition to this, some of the many useful libraries that can be used in a very convenient way by using functional programming were covered.
The most important takeaways should be the following...