Introduction to Functional Programming
Explore the basics of functional programming in Python, understanding its advantages and how it integrates with other paradigms. Learn core concepts such as functions as objects, immutability, recursion, closures, and generators to build a solid foundation in this programming style.
We'll cover the following...
Why functional programming?
Python supports several programming paradigms – procedural, object-oriented, and functional. Of these, functional programming (FP) is probably the least understood and the least used. But it can be a powerful tool, especially as it can be integrated seamlessly with procedural and object-oriented programming (OOP) code.
What to expect?
This course explains what functional programming is, how it is used, and the features of Python that support it. All features are illustrated with example codes.
No prior knowledge of functional programming is assumed, and you don’t need to be an advanced Python programmer to use this course. Any language features used are fully described. All that is required is a basic knowledge of Python. The examples are developed for Python 3.5 or higher, although most will work with earlier 3.x versions too.
You will be introduced to the following aspects of Python, with examples of their application, that are either directly to indirectly relevant to functional programming:
- Objects, variables, and functions as objects
- Immutable objects
- Recursion
- Closures
- Iterators
- Transforming and reducing iterables
- Comprehensions
- Generators
- Partial application and currying
- Functors and monads
- Itertools, functools, and other useful libraries