SlideShare a Scribd company logo
Lambda
Lambda is a keyword in Python used to define functions, more specifically
Anonymous Functions, and such functions are known as Lambda Functions or
Lambda Expressions.
• The expression n ** 2 gets evaluated first, and a value gets returned to the identifier square. The
identifier square can now act as a function, and thus we can pass any number as an argument to find
the square of a number.
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
Keep in mind that the map can take any iterable as an argument and not only a list.
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
• Summary
• Lambda
• Function with many arguments but only one expression.
• It helps to make our code pythonic and to create function wrappers.
• Map
• A function that applies a given function to each item of an iterable and
returns an iterator.
• It provides a faster way to transform an iterable based on the given condition.
• It can have multiple iterables.
• Filter
• It has the same syntax as the map function.
• It helps in extracting items from an iterable based on the given condition.
• Decorators
• A decorator is a design pattern in Python that allows a user to
add new functionality to an existing object without modifying its
structure. Decorators are usually called before the definition of
a function you want to decorate.
• Functions in Python are first class citizens. This means that
they support operations such as being passed as an argument,
returned from a function, modified, and assigned to a variable.
This is a fundamental concept to understand before we delve
into creating Python decorators.
• Before we learn about decorators, we need to understand a few
important concepts related to Python functions. Also,
remember that everything in Python is an object, even functions
are objects.
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
Here, we have created two functions:
•ordinary() that prints "I am ordinary"
•make_pretty() that takes a function as its argument and has a nested function named inner(), and returns
the inner function.
We are calling the ordinary() function normally, so we get the output "I am ordinary".
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
Here, the ordinary() function is decorated with the make_pretty() decorator using the @make_pretty syntax, which is
equivalent to calling ordinary = make_pretty(ordinary).
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
Generators
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx
advancedfunctionalprogramming(lamba).pptx

More Related Content

PPTX
UNIT-02-pythonfunctions python function using detehdjsjehhdjejdhdjdjdjddjdhdhhd
PDF
Python functions
PPTX
Decided to go to the 65 and the value of the number
PPTX
Functions in Python
PDF
Functions-.pdf
KEY
Programming with Python - Week 3
PDF
3-Python Functions.pdf in simple.........
PPTX
Advance python programming
UNIT-02-pythonfunctions python function using detehdjsjehhdjejdhdjdjdjddjdhdhhd
Python functions
Decided to go to the 65 and the value of the number
Functions in Python
Functions-.pdf
Programming with Python - Week 3
3-Python Functions.pdf in simple.........
Advance python programming

Similar to advancedfunctionalprogramming(lamba).pptx (20)

PPTX
2_3 Functions 5d.pptx2_3 Functions 5d.pptx
PDF
Python_Unit_2.pdf
PPTX
_Python_ Functions _and_ Libraries_.pptx
PPTX
Polymorphism
PPTX
Decorators.pptx
PPTX
Advance python
PPTX
Functions_new.pptx
PPTX
Chapter 2 Python Functions
PPTX
Learn more about the concepts Functions of Python
PDF
ESIT135 Problem Solving Using Python Notes of Unit-2 and Unit-3
PPTX
Download Python_Functions_Presentation.pptx
PPTX
Lecture 5 Functions all about business categories
PDF
Functions.pdf cbse board latest 2023-24 all covered
PDF
Dive into Python Functions Fundamental Concepts.pdf
PPTX
lambda engineering students machine learnings.pptx
PDF
Functions2.pdf
PPTX
Functions and modular programming.pptx
PPTX
Java 8 lambda
PPTX
CH.4FUNCTIONS IN C (1).pptx
PPTX
functions.pptx
2_3 Functions 5d.pptx2_3 Functions 5d.pptx
Python_Unit_2.pdf
_Python_ Functions _and_ Libraries_.pptx
Polymorphism
Decorators.pptx
Advance python
Functions_new.pptx
Chapter 2 Python Functions
Learn more about the concepts Functions of Python
ESIT135 Problem Solving Using Python Notes of Unit-2 and Unit-3
Download Python_Functions_Presentation.pptx
Lecture 5 Functions all about business categories
Functions.pdf cbse board latest 2023-24 all covered
Dive into Python Functions Fundamental Concepts.pdf
lambda engineering students machine learnings.pptx
Functions2.pdf
Functions and modular programming.pptx
Java 8 lambda
CH.4FUNCTIONS IN C (1).pptx
functions.pptx
Ad

Recently uploaded (20)

PPT
pwm ppt .pdf long description of pwm....
PDF
202s5_Luciano André Deitos Koslowski.pdf
PPT
BCH3201 (Enzymes and biocatalysis)-JEB (1).ppt
PDF
Women’s Talk Session 1- Talking about women
PPTX
Prokaryotes v Eukaryotes PowerPoint.pptx
PDF
iTop VPN Crack Latest Version 2025 Free Download With Keygen
PPTX
The Stock at arrangement the stock and product.pptx
PPT
2- CELL INJURY L1 Medical (2) gggggggggg
PPTX
1751884730-Visual Basic -Unitj CS B.pptx
PDF
servsafecomprehensive-ppt-full-140617222538-phpapp01.pdf
PPTX
PE3-WEEK-3sdsadsadasdadadwadwdsdddddd.pptx
PPTX
Core Characteristics and Abilities of an Effective Teacher_0.pptx
PPTX
CYBER SECURITY PPT.pptx CYBER SECURITY APPLICATION AND USAGE
PPTX
430838499-Anaesthesiiiia-Equipmenooot.pptx
DOCX
PRACTICE-TEST-12 is specially designed for those
PPTX
employee on boarding for jobs for freshers try it
PPTX
Slideham presentation for the students a
PPTX
The-Scope-of-Food-Quality-and-Safety.pptx managemement
PDF
Beginner’s Guide to Digital Marketing.pdf
PPTX
GPAT Presentation PPT and details about imp topics.pptx
pwm ppt .pdf long description of pwm....
202s5_Luciano André Deitos Koslowski.pdf
BCH3201 (Enzymes and biocatalysis)-JEB (1).ppt
Women’s Talk Session 1- Talking about women
Prokaryotes v Eukaryotes PowerPoint.pptx
iTop VPN Crack Latest Version 2025 Free Download With Keygen
The Stock at arrangement the stock and product.pptx
2- CELL INJURY L1 Medical (2) gggggggggg
1751884730-Visual Basic -Unitj CS B.pptx
servsafecomprehensive-ppt-full-140617222538-phpapp01.pdf
PE3-WEEK-3sdsadsadasdadadwadwdsdddddd.pptx
Core Characteristics and Abilities of an Effective Teacher_0.pptx
CYBER SECURITY PPT.pptx CYBER SECURITY APPLICATION AND USAGE
430838499-Anaesthesiiiia-Equipmenooot.pptx
PRACTICE-TEST-12 is specially designed for those
employee on boarding for jobs for freshers try it
Slideham presentation for the students a
The-Scope-of-Food-Quality-and-Safety.pptx managemement
Beginner’s Guide to Digital Marketing.pdf
GPAT Presentation PPT and details about imp topics.pptx
Ad

advancedfunctionalprogramming(lamba).pptx

  • 1. Lambda Lambda is a keyword in Python used to define functions, more specifically Anonymous Functions, and such functions are known as Lambda Functions or Lambda Expressions.
  • 2. • The expression n ** 2 gets evaluated first, and a value gets returned to the identifier square. The identifier square can now act as a function, and thus we can pass any number as an argument to find the square of a number.
  • 5. Keep in mind that the map can take any iterable as an argument and not only a list.
  • 8. • Summary • Lambda • Function with many arguments but only one expression. • It helps to make our code pythonic and to create function wrappers. • Map • A function that applies a given function to each item of an iterable and returns an iterator. • It provides a faster way to transform an iterable based on the given condition. • It can have multiple iterables. • Filter • It has the same syntax as the map function. • It helps in extracting items from an iterable based on the given condition.
  • 9. • Decorators • A decorator is a design pattern in Python that allows a user to add new functionality to an existing object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate. • Functions in Python are first class citizens. This means that they support operations such as being passed as an argument, returned from a function, modified, and assigned to a variable. This is a fundamental concept to understand before we delve into creating Python decorators. • Before we learn about decorators, we need to understand a few important concepts related to Python functions. Also, remember that everything in Python is an object, even functions are objects.
  • 13. Here, we have created two functions: •ordinary() that prints "I am ordinary" •make_pretty() that takes a function as its argument and has a nested function named inner(), and returns the inner function. We are calling the ordinary() function normally, so we get the output "I am ordinary".
  • 16. Here, the ordinary() function is decorated with the make_pretty() decorator using the @make_pretty syntax, which is equivalent to calling ordinary = make_pretty(ordinary).