<p>I mostly use lambda functions but sometimes use nested functions that seem to provide the same behavior.</p>
<p>Here are some trivial examples where they functionally do the same thing if either were found within another function:</p>
<p><strong>Lambda function</strong></p>
<pre><code>&gt;&gt;&gt; a = lambda x : 1 + x
&gt;&gt;&gt; a(5)
6
</code></pre>
<p><strong>Nested function</strong></p>
<pre><code>&gt;&gt;&gt; def b(x): return 1 + x

&gt;&gt;&gt; b(5)
6
</code></pre>
<p>Are there advantages to using one over the other? (Performance? Readability? Limitations? Consistency? etc.)</p>
<p>Does it even matter? If it doesn't then does that violate the Pythonic principle:</p>
<blockquote>
<p><a href="https://www.python.org/dev/peps/pep-0020/" rel="noreferrer">There should be one-- and preferably only one --obvious way to do it.</a>.</p>
</blockquote>

If you need to assign the
```
lambda
```
to a name, use a
```
def
```
instead.
```
def
```
s are just syntactic sugar for an assignment, so the result is the same, and they are a lot more flexible and readable.
```
lambda
```
s can be used for
use once, throw away
functions which won't have a name.
However, this use case is very rare. You rarely need to pass around unnamed function objects.
The builtins
```
map()
```
and
```
filter()
```
need function objects, but
list comprehensions
and
generator expressions
are generally more readable than those functions and can cover all use cases, without the need of lambdas.
For the cases you really need a small function object, you should use the
```
operator
```
module functions, like
```
operator.add
```
instead of
```
lambda x, y: x + y
```
If you still need some
```
lambda
```
not covered, you might consider writing a
```
def
```
, just to be more readable. If the function is more complex than the ones at
```
operator
```
module, a
```
def
```
is probably better.
So, real world good
```
lambda
```
use cases are very rare.