Feral Cat

Building just because.
python

Python Lambda Functions For Idiots

What are Python Lambda Functions? They weren’t something I could easily infer from casually seeing it in code or context clues. I had to do a little digging. What I took from my reading, is that they are more concisely written functions.

My Setup

  • Python 3.x
  • macOS

Example

They make this:

def doSomething(foo):
    return foo

Into this:

doSomething = lambda foo:foo

I personally think they’re beautiful which is why I did the bit of research. I’ll have more tell as I incorporate Python Lambda functions into daily use. Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *