lambdas icon indicating copy to clipboard operation
lambdas copied to clipboard

How to get access to args/kwargs inside lambda?

Open gtors opened this issue 4 years ago • 1 comments

Is it possible to express this kind of lambda? lambda a, b: a * b

I intuitively tried this approach, but it doesn't work... _._1 * _._2

gtors avatar Sep 16 '21 17:09 gtors

So, I implemented my own version 🤖

from lambdaz import a0, a1, a2

fn = ((a0 + a1) / a2)._
fn(1, 2, 3)  # out: 1.0

fn = a0.strip().title()._
fn("    hello world   ") # out: Hello World

gtors avatar Oct 03 '21 23:10 gtors