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

    Mar 8, 2011 · Also lambda can be used in an expression directly, while def is a statement. def f(x, y): return x + y Would give you almost the same result as. f = lambda x, y: x + y And you can …

  2. Is there a way to perform "if" in python's lambda?

    I've tested this in Python 2.7 since I don't have Python 2.6 installed, but I really can't imagine this is valid in Python 2.6, since you can't use print in a lambda expression. – wovano Commented …

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

    @Javier I agree with you if you are talking about "lambda" the concept; however, if we're talking about "lambda" the python keyword then: 1) named functions are faster and can do more …

  4. Understanding lambda in Python and using it to pass multiple …

    Because a lambda is (conceptually) the same as a function, just written inline. Your example is equivalent to . def f(x, y) : return x + y just without binding it to a name like f. Also how do you …

  5. python - Define a lambda expression that raises an Exception

    Nov 28, 2011 · The result of this map operation is a list with one entry, the one returned by lambda x, y, z, which is why we need this lambda: if we would use __setattr__ right away, we …

  6. dictionary - lambda in python can iterate dict? - Stack Overflow

    Oct 12, 2015 · The code inside the lambda might iterate something, but only in the same ways as any other function might use (provided they are expressions, and so valid inside a lambda). In …

  7. language agnostic - What is a lambda (function)? - Stack Overflow

    Aug 19, 2008 · A Lambda Function, or a Small Anonymous Function, is a self-contained block of functionality that can be passed around and used in your code. Lambda has different names in …

  8. Python lambda does not accept tuple argument - Stack Overflow

    Jul 4, 2012 · You are probably running Python 3.x on Windows, and Python 2.x on Linux. The ability to unpack tuple parameters was removed in Python 3: See PEP 3113. You can …

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

    This question touches a very stinking part of the "famous" and "obvious" Python syntax - what takes precedence, the lambda, or the for of list comprehension. I don't think the purpose of the …

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

    @J.F. Sebastian, yes, "operator.itemgetter" ,and hundreds of other short functions one would have to know by heart, each to one specific use -- or use lambda, where one can create a …

Refresh