Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

546
Views
Python: What is the difference between `lambda` and `lambda_`?

I know the function of lambda: and lambda var: , but what does lambda_: means acutally?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

lambda_ is just a variable name, like any other. Like foo or x.

If you saw:

lambda_: Something

Then that is actually a variable annotation, for type hints, so the same as:

num: int
num = 0
over 4 years ago · Santiago Trujillo Report

0

lambda: means lambda method doesn't take any argument

#!/usr/bin/env python3.10

def caller(var):
    var()


caller(lambda : print("OP"))

lambda var: means method is taking var as argument

#!/usr/bin/env python3.10

def caller(var,arg):
    var(arg)


foo = lambda x: print(x)
caller(foo, "OP")

lambda _: here _ is an argument

#!/usr/bin/env python3.10

def caller(var,__):
    var(__)


foo = lambda _ : print(_)
caller(foo, "OP")

output for all above program is OP

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!