tbh, even assigning a lambda to a variable seems unpythonic to me. if it needs a name, define it as a regular function. The difference between a lambda function and a regular function is that the latter has a __name__
attribute and an explicit return statement.
if you must add a docstring to a lambda, do it like this:
f = lambda x: x + 1
f.__doc__ = """adds 1 to input-arg"""
help(f)
# outputs the following:
help(f)
Help on function <lambda> in module __main__:
<lambda> lambda x
adds 1 to arg
This way, the documentation is actually available to the interpreter as a function docstring.
Quoting directly from pep-8
Always use a def statement instead of an assignment statement that binds a lambda expression directly to an identifier.
Yes:
def f(x): return 2*x
No:
f = lambda x: 2*x