Lambda Expressions in Python

How to write lambda (or anonymous) functions in Python

Luay Matalka
Towards Data Science
4 min readSep 11, 2020

--

Photo by Markus Spiske on Unsplash

Introduction

Imagine we are coding and need to write a simple function. However, we are only going to be using this function once and thus it seems unnecessary to create an entire function with the def keyword for that one task. Well, that’s where lambda expressions come in.

--

--

Lead Machine Learning Engineer, specializing in MLOps, with a passion for teaching.