This page looks best with JavaScript enabled

Lambda Functions in Python

 ·  🎃 kr0m

There are times when we need to define a function in Python but this function will be used only in one point of the code, Python allows us to define lambda functions for these cases, which are nothing more than functions defined on the fly.

We will see this very clearly with a simple example:

>>> f = lambda x: x + 1
>>> f(3)
4
If you liked the article, you can treat me to a RedBull here