Python is not a functional programming language, but it is a multi-paradigm language that makes functional programming easy to perform, and easy to mix with other programming styles. Python is a high level language used in many development areas, like web development, data analysis, desktop UI and system administration. Functional programming is a style of programming that is characterized by short functions, lack of statements, and little reliance on variables. You will learn what functional programming is, and how you can apply functional programming in Python. If you're interested to use Functional Programming as a powerful tool to solve many real-world problems by writing robust and bug-free code, then go for this Learning Path.
Python is not a functional programming language, but it is a multi-paradigm language that makes functional programming easy to perform, and easy to mix with other programming styles. Python is a high level language used in many development areas, like web development, data analysis, desktop UI and system administration. Functional programming is a style of programming that is characterized by short functions, lack of statements, and little reliance on variables. You will learn what functional programming is, and how you can apply functional programming in Python. If you're interested to use Functional Programming as a powerful tool to solve many real-world problems by writing robust and bug-free code, then go for this Learning Path.
Packt’s Video Learning Paths are a series of individual video products put together in a logical and stepwise manner such that each video builds on the skills learned in the video before it.
The highlights of this Learning Path are:
In this Learning Path, you’ll learn what functional programming is, and how it differs from other programming styles, such as procedural and object-oriented programming. Then you’ll go on to explore lambda expressions, which are short one-line functions, and are the purest form of functional programming that Python offers. Next, you’ll learn about higher-order functions: functions that accept other functions as an argument, or return other functions as return values. You’ll also encounter important concepts from functional programming, such as monads, currying, statelessness, side-effects, memorization, and referential transparency; these concepts may initially seem odd to Python programmers, but you’ll see how they are elegantly supported by the language.
Further, you’ll learn everything there is to know about iterators in Python and how crucial they are in functional programming, where they are used, among other things, to implement repetitive logic and coroutines. You’ll learn about all standard iterators and iterator functions that Python offers. You’ll also learn to implement your own iterators. Functional programming makes heavy use of iterators, and you’ll learn how you can use them in functional programming through an interactive calculator application.
By the end of this Learning Path, you will get a thorough understanding of iterators to solve many real-world problems by writing robust, testable, and bug-free code.
Meet Your Expert:
We have combined the best works of the following esteemed authors to ensure that your learning journey is smooth:
SebastiaanMathôt currently works as assistant professor at the University of Groningen in the Netherlands. He is the lead developer at OpenSesame, which is an open-source, Python-based program for implementing psychology and neuroscience experiments. Sebastiaan is also the designer of DataMatrix, a Python library for numeric computing that is focused on elegance and readability. Sebastiaan also gives regular workshops on using OpenSesame and Python for scientific purposes, and regularly publishes Python tutorials on his YouTube channel. As such, he has extensive experience in teaching Python and making advanced topics seem as easy as possible.
This video gives an overview of entire course.
In this video, we will consider iterator unpacking, a neat and, Python trick to assign multiple elements from an iterator to multiple variables – in a single statement.
In this video, we will see how a basic calculator application can be implement using two different programming styles, procedural and functional. By doing so, we will get a first taste of functional programming.
In this video, we will see what statelessness, side-effects, and referential transparency are.
In this video, we will consider two ways of testing code, unit testing and through formal proofs.
In this video, we will consider recursion (functions that call themselves), which is often used in functional programming instead of loops.
In this video, we will consider how functional programming doesn’t always match how humans think of the world as consisting of objects.
Functional programming relies heavily on expressions, and eschews statements. But what is the difference between the two? In this video, we will learn exactly how statements and expressions differ.
In this video, we will look at lambda expressions. This is the purest form of functional programming that Python offers. Lambda expressions are functions that consist of a single expression and which do not need to have a name.
In this video, we will take a closer look at ‘and’ and ‘or’.
In this video, we will consider ‘if’ expressions. These are the functional alternatives to the far more commonly used ‘if’ statements.
In this video, we will consider how you can pass a function as an argument to another function. The receiving function is by definition a higher-order function.
In this video, we will look at nested functions, that is, functions that are defined inside other functions. We will also consider variable scope, that is, from which functions variables are accessible. These are important concepts for higher order functions.
In this video, we will see how a higher-order function can return functions as return values.
Because operators (+, -, /, and so on) are syntax and not objects, you cannot pass them as arguments or return values. To bypass this problem, the Python operator module offers all operators also as functions.
In this video, we will consider decorators. Decorators are an elegant and Pythonic syntax to implement specific kinds of higher-level functions.
In this video, we will consider decorators that accept arguments. This makes the decorator design pattern even more flexible.
In this video, we will look at currying, a technique for turning a function that takes multiple arguments into a chain of function that each take one argument.
In this video, we will look at monads. Most discussions of monads are complicated, and use lots of mathematical terminology. But, as we will see in this video, the idea of monads is really simple.
In this video, we will look at memoization, which is a technique to optimize code by storing return values of functions.
In this video, we will look at exceptions, which are the standard Python approach to error handling.
In this video, we will look at an alternative approach to error handling, using a Maybe-like decorator. This resembles the Maybe monad, but takes a more Pythonic approach.
In this video, we will take everything that we’ve learned, and use this newly acquired knowledge to polish the interactive calculator that we developed at the start of this section with the help of all using a functional programming style.
In this video, we will first introduce important concepts –iterators, mutability, and order. Next, we will consider Python’s most common built-in iterator – the list.
In this video, we will take a look at the tuple, another very common iterator. We also consider some things you can do with Iterators in general (not only tuples).
In this video, we will consider the dict, another common Python iterator; but very different from lists and tuples.
In this video, we will introduce the set, another built-in iterator, but one that is focused more on mathematical situations.
In this video, we consider theiterator protocol, which formally defines iterator objects, and describes the (minimum) functionality that iterators provide.
In this video, we will see how you can write a class that implements theiterator protocol.
In this video, we will considergenerators, which are functions that implement theiterator protocol in an elegant and simple way.
In this video, we will show how you can use generators to implement lazy evaluation – evaluating elements from aniterator only if and when they are required.
In this video, we will consider generator coroutines, which are generator functions that run in rapidly alternating suspend-resume cycles. This is sometimes called light-weight threading.
In this video, we will consider the collections module, which is part of the Python standard library, and which provides several convenient predefined iterator objects.
In this video, we first consider the difference between statements and expression. We then look at the list comprehension, which is an expressive alternative to the ‘for’ statement.
In this video, we will look at the Dict comprehension, which is similar to the list comprehension, but for Dict objects.
In this video, we will considergenerators expressions which are similar to list comprehensions but use generator.
In this video, we will look at nested loops. Nested loops (that is a ‘for’ loop within a ‘for’ loop) are mostly used when you need all possible combinations of the elements of two lists. Nested comprehensions allow you to implement this very elegantly.
In this video, we will look at four functions for working with iterators that are built into Python: zip(), map(), enumerate(), and filter().
In this video, we will look at several built-in functions for performing numerical and logical operations on iterators.
In this video, we will consider the most important functions from the itertools module, which is part of the Python standard library. The itertools module provides many convenient functions for working with iterators.
In this video, we first consider higher-order functions, which are functions that use other functions as arguments or return values. Then we move on to consider the most important functions from the functools module, which is part of the Python standard library, and provides convenient higher-order functions.
In this video, we will consider generator coroutines, which are generator functions that run in rapidly alternating suspend-resume cycles. This is sometimes called light-weight threading.
In this video, we will consider good coding practice. For most problems, many different solutions exist. In this course, we have considered solutions that rely on iterators. But, while iterators are powerful, they are not always the best solution to a given problem.
In this video, we will consider an interactive calculator that is implemented using a sensible mix of programming techniques, including those that we’ve learned in this course.
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.