About 50 results
Open links in new tab
  1. What exactly is "lambda" in Python? - Stack Overflow

    Mar 8, 2011 · 16 Lambda is more of a concept or programming technique then anything else. Basically it's the idea that you get a function (a first-class object in python) returned as a result …

  2. What is `lambda` in Python code? How does it work with `key` …

    I saw some examples using built-in functions like sorted, sum etc. that use key=lambda. What does lambda mean here? How does it work? For the general computer science concept of a …

  3. python - How are lambdas useful? - Stack Overflow

    As stated above, the lambda operator in Python defines an anonymous function, and in Python functions are closures. It is important not to confuse the concept of closures with the operator …

  4. What does "lambda" mean in Python, and what's the simplest way …

    Oct 18, 2009 · In Python it is only possible to make a lambda that returns a single expression, and the lambda cannot span multiple lines (unless you join the multiple lines by using the …

  5. python - Why use lambda functions? - Stack Overflow

    I don't know python (although it's definitely high on my to-learn list), so I'm wondering... is there really a good reason multiple lines aren't allowed for a lambda-expression? Why can't the body …

  6. python - Lambda function in list comprehensions - Stack Overflow

    Why is the output of the following two list comprehensions different, even though f and the lambda function are the same? f = lambda x: x*x [f(x) for x in range(10)] and [lambda x: x*x for x in r...

  7. Understanding Python Lambda behavior with Tkinter Button

    Dec 18, 2021 · Understanding Python Lambda behavior with Tkinter Button [duplicate] Asked 4 years, 1 month ago Modified 8 months ago Viewed 13k times

  8. Is there a way to perform "if" in python's lambda? [duplicate]

    An easy way to perform an if in lambda is by using list comprehension. You can't raise an exception in lambda, but this is a way in Python 3.x to do something close to your example:

  9. Python's lambda with underscore for an argument?

    Apr 21, 2015 · Underscore is a Python convention to name an unused variable (e.g. static analysis tools does not report it as unused variable). In your case lambda argument is unused, …

  10. python - lambda expression with *args - Stack Overflow

    Nov 13, 2014 · As you can see, it is a tuple that contains the lambda function. This is expected though because *args always collects its arguments into a tuple, which the function f then returns.