The only way I can think of to do this amounts to giving the function a name:

fact = lambda x: 1 if x == 0 else x * fact(x-1)

or alternately, for earlier versions of python:

fact = lambda x: x == 0 and 1 or x * fact(x-1)

Update: using the ideas from the other answers, I was able to wedge the factorial function into a single unnamed lambda:

>>> map(lambda n: (lambda f, *a: f(f, *a))(lambda rec, n: 1 if n == 0 else n*rec(rec, n-1), n), range(10))
[1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880]

So it's possible, but not really recommended!

Answer from Greg Hewgill on Stack Overflow
🌐
Dot Net Tutorials
dotnettutorials.net › home › recursive and lambda functions in python
Recursive and Lambda Functions in Python with Examples
April 21, 2021 - The name of the function is the mandatory item in the function definition as discussed earlier. But, in python, we have a keyword called ‘lambda’ with which we can define a simple function in a single line without actually naming it.
🌐
Python Examples
pythonexamples.org › python-recursive-lambda-function
Python – Recursive Lambda Function
Here it is! Our lambda function that can take a number, and return its factorial using recursion technique.
🌐
Rip Tutorial
riptutorial.com › recursive lambda using assigned variable
Python Language Tutorial => Recursive Lambda using assigned variable
A common example of this is the ... code: lambda_factorial = lambda i:1 if i==0 else i*lambda_factorial(i-1) print(lambda_factorial(4)) # 4 * 3 * 2 * 1 = 12 * 2 = 24 · The lambda function, through its variable assignment, is passed a value (4) which it evaluates and returns 1 if it is 0 or else it returns the current value (i) * another calculation by the lambda function of the value - 1 (i-1)...
🌐
Plain English
python.plainenglish.io › how-to-write-terrible-code-using-recursive-python-lambdas-e41374d278f1
How to Write Terrible Code, Using Recursive Python Lambdas | by Filip Sufitchi | Python in Plain English
May 15, 2020 - Do you ever code deliberately awful stuff, just because you can? Here’s a way to do it using lambdas that call themselves recursively.
🌐
Quora
quora.com › Can-you-explain-how-to-use-recursion-and-lambda-functions-in-Python-to-recursively-sum-up-lists
Can you explain how to use recursion and lambda functions in Python to recursively sum up lists? - Quora
Answer: “Can you explain how to use recursion and lambda functions in Python to recursively sum up lists?” I can think of ways to use recursion, or ways to use lambda functions, but no obvious way to use them together. Recursion. We have a function which calls itself.
Find elsewhere
🌐
Wikipedia
en.wikipedia.org › wiki › Anonymous_recursion
Anonymous recursion - Wikipedia
November 26, 2025 - Using a higher-order function so ... standard recursive function as an argument: def fact0(n0): if n0 == 0: return 1 return n0 * fact0(n0 - 1) fact1 = lambda f, n1: 1 if n1 == 0 else n1 * f(n1 - 1) fact = lambda n: fact1(fact0, n)...
🌐
Medium
medium.com › inspiredbrilliance › aws-lambda-long-running-functions-using-tail-recursion-6f5b59133a94
AWS Lambda: Long-Running Functions using Tail Recursion | by Kulbhushan Singhal | inspiringbrilliance | Medium
October 17, 2019 - This method returns the milliseconds left before the Lambda function execution will time out. To achieve recursion, we keep checking the time remaining in the loop while processing the items and make a recursive call when the time remaining ...
🌐
Blogger
metapython.blogspot.com › 2010 › 11 › recursive-lambda-functions.html
metapython: Recursive Lambda Functions
November 6, 2010 - This one I had presented at my ... functions to call themselves, using recursion. You can do that in Python if you assign a name to an anonymous function -- but DUH -- it won't be anomous anymore. So, it is possible to do: fact = lambda n: n * fact(n - 1) if n > 1 else 1 fact(5) ...
🌐
Msdotnet
msdotnet.co.in › 2020 › 09 › lambda-and-recursive-functions-in-python.html
Lambda and Recursive functions in python | MY NET Tutorials
Lambda function and recursive function is used in python.lambda function can take more than arguments but return only one argument.
🌐
Virtual Maestro
virtualmaestro.in › 2020 › 04 › 07 › learning-python-part-24-recursive-function-lambda-function
Learning Python Part-24: Recursive function, Lambda Function – Virtual Maestro
April 7, 2020 - Python Recursive Function:Recursion is the process of defining something in terms of itself. We know that in Python, a function can call other functions. It is even possible for the function to call itself. These type of construct are termed as recursive functions.Following is an example of recursive function to find the factorial of an integer.Factorial…
🌐
Python Examples
pythonexamples.org › python-lambda
Python Lambda Function
#recursive lambda function factorial = lambda a: a*factorial(a-1) if (a>1) else 1 #call lambda function result = factorial(5) print(result)
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › understanding lambda function invocation methods › use lambda recursive loop detection to prevent infinite loops
Use Lambda recursive loop detection to prevent infinite loops - AWS Lambda
For Lambda to detect recursive loops, your function must use one of the following SDK versions or higher: Some Lambda runtimes such as Python and Node.js include a version of the AWS SDK. If the SDK version included in your function's runtime is lower than the minimum required, then you can ...
🌐
DEV Community
dev.to › otumianempire › python3-programming-exercise-12-c-2j9j
Python3 Programming - Exercise 12 c - Recursive and lambda functions - DEV Community
November 16, 2021 - So the structure of a lambda function is similar to that of normal function. We use the lambda keyword instead of def, the function has no name. Any parameters are space comma-separated from the lambda keyword.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-lambda-anonymous-functions-filter-map-reduce
Python Lambda Functions - GeeksforGeeks
The lambda function takes x as input. It uses nested if-else statements to return "Positive," "Negative," or "Zero." Below example checks divisibility by 2 and returns "Even" or "Odd" accordingly.
Published   2 weeks ago
🌐
GeeksforGeeks
geeksforgeeks.org › python › recursion-in-python
Recursion in Python - GeeksforGeeks
Example: This code compares tail recursion and non-tail recursion using two versions of factorial function one with an accumulator (tail-recursive) and one with multiplication after recursive call (non-tail-recursive).
Published   1 week ago