Functional Programming in Python
0.0 (0 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
6 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Functional Programming in Python to your Wishlist.

Add to Wishlist

Functional Programming in Python

Use Functional Programming as a powerful tool to solve many real-world problems by writing robust, testable, and bug-fre
0.0 (0 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
6 students enrolled
Created by Packt Publishing
Last updated 8/2017
Curiosity Sale
Current price: $10 Original price: $125 Discount: 92% off
30-Day Money-Back Guarantee
  • 2.5 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Recognize the value of Functional Programming
  • Understand the advantages and disadvantages of Functional Programming
  • Higher-order functions and Lambda expressions (nameless functions)
  • Error handling in Functional Programming
  • Understand common functional design patterns, and how these apply to Python
View Curriculum
  • Should have basic understanding of Python.

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.

In this video course, we will learn what functional programming is, and how it differs from other programming styles, such as procedural and object-oriented programming. We will also learn why and when functional programming is useful, and why and when it makes programs unnecessarily complex. Then we go on to explore lambda expressions, which are short one-line functions, and are the purest form of functional programming that Python offers. Next, we will learn about higher-order functions: functions that accept other functions as argument, or return other functions as return values. In Python, higher-order functions are elegantly supported through decorators. We will also encounter important concepts from functional programming, such as monads, currying, statelessness, side-effects, memoization, and referential transparency; these concepts may initially seem odd to Python programmers, but we will see how they are elegantly supported by the language. In fact, many Python programmers already make use of concepts from functional programming without being aware of doing so.

All the videos in this course contain hands-on examples of the introduced concepts. We will also consider several different implementations of an interactive calculator to illustrate how you can use functional programming in a simple-but-complete program.

About The Author

Sebastiaan Mathô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.

Who is the target audience?
  • This course is intended for developers who have a basic understanding of Python and want to expand their developer toolbox with important new techniques.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
22 Lectures
Exploring the Pros and Cons of Functional Python with an Example
6 Lectures 47:27

This video gives an overview of entire course.

Preview 04:38

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.

Example - A Functional, Interactive Calculator

In this video, we will see what statelessness, side-effects, and referential transparency are.

Pro - Stateless, Referentially Transparent Functions Produce the Same Result

In this video, we will consider two ways of testing code, unit testing and through formal proofs.

Pro - You Can Prove That Code Is Correct at Least in Theory

In this video, we will consider recursion (functions that call themselves), which is often used in functional programming instead of loops.

Con - Complexity and Overly Deep Recursion

In this video, we will consider how functional programming doesn’t always match how humans think of the world as consisting of objects.

Con - Functional Programming Can Be Unintuitive
Lambda Expressions or Nameless Functions
4 Lectures 25:20

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.

Preview 06:29

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.

Diving into Lambda Expressions

In this video, we will take a closer look at ‘and’ and ‘or’.

Understanding 'and' and 'or'

In this video, we will consider ‘if’ expressions. These are the functional alternatives to the far more commonly used ‘if’ statements.

Diving into Inline 'if' Expressions
Higher-order Functions - Functions as Arguments and Return Values
6 Lectures 36:52

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.

Preview 09:17

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.

Nesting a Function in Another Function

In this video, we will see how a higher-order function can return functions as return values.

Returning a Function from Another Function

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.

The Operator Module - Operators as Regular Functions

In this video, we will consider decorators. Decorators are an elegant and Pythonic syntax to implement specific kinds of higher-level functions.

Decorators - The @ Prefix

In this video, we will consider decorators that accept arguments. This makes the decorator design pattern even more flexible.

Decorators with Arguments
Common Functional Design Patterns
3 Lectures 21:54

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.

Preview 07:32

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.

Monads - Variables That Decide How They Should Be Treated

In this video, we will look at memoization, which is a technique to optimize code by storing return values of functions.

Memoization - Remembering Results
Errors and Exceptions in Lambda Expressions
3 Lectures 23:11

In this video, we will look at exceptions, which are the standard Python approach to error handling.

Preview 04:56

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.

Handling Errors in Lambda Expressions

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.

Example - A Fully Functional, Interactive Calculator
About the Instructor
Packt Publishing
3.9 Average rating
7,297 Reviews
52,272 Students
616 Courses
Tech Knowledge in Motion

Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.

With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.

From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.

Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.