A regular function can contain a call to itself in its definition, no problem. I can't figure out how to do it with a lambda function though for the simple reason that the lambda function has no name to refer back to. Is there a way to do it? How?
Python – Can a lambda function call itself recursively in Python
lambdapythonrecursiony-combinator
Best Answer
The only way I can think of to do this amounts to giving the function a name:
or alternately, for earlier versions of python:
Update: using the ideas from the other answers, I was able to wedge the factorial function into a single unnamed lambda:
So it's possible, but not really recommended!