Functional Programming in Python

Video description

Use Functional Programming as a powerful tool to solve many real-world problems by writing robust, testable, and bug-free code

About This Video

  • Expand your knowledge of Python by understanding its functional aspect

  • Leverage the power of Functional Programming to solve real-world problems

  • Acquire hands-on content with many practical real-world examples.

  • In Detail

    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.

    Publisher resources

    Download Example Code

    Table of contents

    1. Chapter 1 : Exploring the Pros and Cons of Functional Python with an Example
      1. The Course Overview 00:04:38
      2. Example – A Functional, Interactive Calculator 00:11:47
      3. Pro – Stateless, Referentially Transparent Functions Produce the Same Result 00:07:05
      4. Pro – You Can Prove That Code Is Correct at Least in Theory 00:08:34
      5. Con – Complexity and Overly Deep Recursion 00:06:11
      6. Con – Functional Programming Can Be Unintuitive 00:09:15
    2. Chapter 2 : Lambda Expressions or Nameless Functions
      1. The Difference Between Statements and Expressions 00:06:30
      2. Diving into Lambda Expressions 00:06:09
      3. Understanding ‘and’ and ‘or’ 00:07:22
      4. Diving into Inline ‘if’ Expressions 00:05:21
    3. Chapter 3 : Higher-order Functions – Functions as Arguments and Return Values
      1. Passing a Function as an Argument to Another Function 00:09:18
      2. Nesting a Function in Another Function 00:06:41
      3. Returning a Function from Another Function 00:04:42
      4. The Operator Module – Operators as Regular Functions 00:04:59
      5. Decorators – The @ Prefix 00:04:41
      6. Decorators with Arguments 00:06:33
    4. Chapter 4 : Common Functional Design Patterns
      1. Currying – One Argument per Function 00:07:32
      2. Monads – Variables That Decide How They Should Be Treated 00:07:07
      3. Memoization – Remembering Results 00:07:16
    5. Chapter 5 : ChapterName
      1. You Cannot Catch Exceptions in Lambda Expressions 00:04:57
      2. Handling Errors in Lambda Expressions 00:05:35
      3. Example – A Fully Functional, Interactive Calculator 00:12:41

    Product information

    • Title: Functional Programming in Python
    • Author(s): Sebastiaan Mathot
    • Release date: July 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781788292450